ubc / iPeer

Peer Evaluation System
http://ipeer.ctlt.ubc.ca
Other
17 stars 18 forks source link

FIX mixeval edit #660

Closed kitsook closed 3 years ago

kitsook commented 3 years ago

When user tried to edit and save a mixed eval, the creator_id was incorrectly updated to 0 causing the user can't access the eval.

The controller calls saveAll with 'validate' equals to 'only' to simulate a save to perform validation. Within the cake library, it will reset the model's default values, including the creator_id.

To avoid the creator_id reset to zero when edited, set the 'created' date field.

Previously the 'created' field was set to current datetime whenever the record is saved. This logic was removed recently as it incorrectly update the field when the record is being edited.

This fix tries to set the 'created' field to the existing value when the record is being edited.