git4school / git4school-visu

Git4School, a dashboard for supporting teacher interventions in Software Engineering courses
https://git4school.firebaseapp.com/
Apache License 2.0
2 stars 3 forks source link

Error when importing an assignment with a milestone #106

Closed F0urchette closed 3 years ago

F0urchette commented 3 years ago

Description

When exporting an assignment, dates are transformed to strings. Then, when importing back the assignment, using class-transformer to cast the plain javascript object to an instance of a class doesn't call its constructor. Therefore, the milestones are imported with its date as a string while a Date is expected. As a result, when calling a Date method, an error is thrown.

Steps to reproduce

  1. Create a new assignment, with a repository
  2. Load this assignment
  3. Add a milestone
  4. Export the assignment
  5. Import back the assignment
  6. Load the imported assignment

Actual result

When loading the assignment, the following error is thrown and the assignment is not loaded. Also, the whole application is frozen and a reload is required.

image

Expected result

The assignment is successfully loaded.

Hints

Make sure that class-transformer transforms the dates to the right format, using @Type(() => Date)