Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
IonMich committed Jan 24, 2024
2 parents babca96 + 4382148 commit d5f5916
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions submissions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,18 @@ def api_grade_update_view(request, submission_pk):
author=request.user,
text=request.POST.get('new_comment'))
comment.save()

# parse date as e.g. Dec. 31, 2020, 11:59 p.m. at the local timezone
created = (comment.created_at.astimezone()
.strftime("%b. %-d, %Y, %-I:%M %p")
.strftime("%b. %d, %Y, %I:%M %p")
.replace("AM", "a.m.")
.replace("PM", "p.m.")
)
# remove leading zeros from %d and %I
created = created.replace(" 0", " ")

print("comment saved")
# parse date as e.g. Dec. 31, 2020, 11:59 p.m. at the local timezone

serialized_comment = {
'pk': str(comment.pk),
'text': comment.text,
Expand All @@ -347,10 +352,12 @@ def api_grade_update_view(request, submission_pk):
for comment_pk in created_comment_pks:
comment = SubmissionComment.objects.get(pk=comment_pk)
created = (comment.created_at.astimezone()
.strftime("%b. %-d, %Y, %-I:%M %p")
.strftime("%b. %d, %Y, %I:%M %p")
.replace("AM", "a.m.")
.replace("PM", "p.m.")
)
)
# remove leading zeros from %d and %I
created = created.replace(" 0", " ")
serialized_comment = {
'pk': str(comment.pk),
'text': comment.text,
Expand Down

0 comments on commit d5f5916

Please sign in to comment.