Let $X$ be a random variable with pdf
$$ f(x) = \begin{cases} \frac{1}{2}, & \text{if } -1 \leq x \leq 1 \\ 0, & \text{elsewhere} \end{cases} $$
Consider the following random variable $Y$ as
$$ Y = \begin{cases} x, & \text{if } x \geq 0 \\ 0, & \text{if } x < 0 \end{cases} $$
Find the cdf of $Y$.
My attempt:
$$F_Y(y) = P(Y\le y) = P(x\le y) = F_X(y) = \begin{cases} 0,&\text{if } y<-1 \\ \frac{1}{2}{y}+\frac{1}{2}, & \text{if } -1 \leq y < 1 \\ 1, & \text{if } y\geq1 \end{cases}$$
Am I on the right path?