Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
fff
Browse files Browse the repository at this point in the history
  • Loading branch information
Its-OP committed Mar 3, 2024
1 parent e8e83fe commit 7cdfbf5
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions Backend/Web/Controllers/ActivitiesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ public async Task<IActionResult> CreateActivities([FromRoute] int subjectId,
if (activityType is null)
return BadRequest(new ErrorContract($"Activity type {activityType} does not exist"));

if (!DateTime.TryParse(conductedAtISO8601, out var date))
return BadRequest(new ErrorContract("Date cannot be parsed"));

if (date > DateTime.Now)
return BadRequest(new ErrorContract("Activity cannot be performed in the future"));

if (apiActivities.Count > 50)
return BadRequest(new ErrorContract("Too many activities"));

Expand All @@ -79,7 +73,7 @@ public async Task<IActionResult> CreateActivities([FromRoute] int subjectId,
var activity = new Activity
{
ActivityType = activityType,
ConductedAt = date.RoundToMinutes(),
ConductedAt = DateTime.Now.AddDays(-(new Random().Next(1, 100))).RoundToMinutes(),
Score = maxScore > apiActivity.Score ? apiActivity.Score : maxScore,
MaxScore = maxScore,
Student = students[apiActivity.StudentId],
Expand Down

0 comments on commit 7cdfbf5

Please sign in to comment.