A criminal defendant or a juvenile may be assigned to perform a work project under a community service program only if:
(1) the juvenile or defendant consents to the assignment;
(2) the juvenile or defendant is not compensated for the work performed; and
(3) in the case of a defendant, the individual has not been convicted of a crime of violence.