Skip to content

Commit

Permalink
Merge pull request #449 from kzi-nastava/fix/date-format
Browse files Browse the repository at this point in the history
[fix] date format inconsistency
  • Loading branch information
natasakasikovic authored May 28, 2024
2 parents 627348e + a649ec3 commit 554e936
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion LangLang/Domain/Models/Course.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public override string ToString()
{
sbDays.Remove(sbDays.Length - 1, 1);
}
return string.Join("|", new object[] { Id, TutorId, Language, Level.ToString(), NumberOfWeeks, sbDays.ToString(), Online, NumberOfStudents, MaxStudents, StartDateTime.ToString(), CreatedByDirector, Modifiable, GratitudeEmailSent, CreatedAt});
return string.Join("|", new object[] { Id, TutorId, Language, Level.ToString(), NumberOfWeeks, sbDays.ToString(), Online, NumberOfStudents, MaxStudents, StartDateTime.ToString(Constants.DATE_TIME_FORMAT), CreatedByDirector, Modifiable, GratitudeEmailSent, CreatedAt.ToString(Constants.DATE_TIME_FORMAT) });
}

public string ToPdfString()
Expand Down
2 changes: 1 addition & 1 deletion LangLang/Repositories/CourseRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Dictionary<int, Course> Load()
bool createdByDirector = bool.Parse(tokens[10]);
bool modifiable = bool.Parse(tokens[11]);
bool gratitudeEmailSent = bool.Parse(tokens[12]);
DateTime createdAt = DateTime.Parse(tokens[13]);
DateTime createdAt = DateTime.ParseExact(tokens[13], Constants.DATE_TIME_FORMAT, null);
var course = new Course(id, tutorId, language, level, numOfWeeks, daysOfWeek, online, numOfStud, maxStud, startDateTime, createdByDirector, modifiable, gratitudeEmailSent, createdAt);

courses.Add(course.Id, course);
Expand Down
7 changes: 4 additions & 3 deletions LangLang/Repositories/ExamSlotRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ public void Save()
exam.Applicants.ToString(),
exam.Modifiable.ToString(),
exam.ResultsGenerated.ToString(),
exam.ExamineesNotified.ToString());
exam.ExamineesNotified.ToString(),
exam.CreatedAt.ToString(Constants.DATE_TIME_FORMAT));
});

File.WriteAllLines(_filePath, lines);
Expand Down Expand Up @@ -123,8 +124,8 @@ public Dictionary<int, ExamSlot> Load()
bool modifiable = bool.Parse(values[8]);
bool resultsGenerated = bool.Parse(values[9]);
bool examineesNotified = bool.Parse(values[10]);
DateTime createdAt = DateTime.Parse(values[11]);
DateTime createdAt = DateTime.ParseExact(values[11], Constants.DATE_TIME_FORMAT, null);

ExamSlot exam = new ExamSlot(id, language, level, timeSlot, maxStudents, tutorId, applicants, modifiable, resultsGenerated, examineesNotified, createdAt);
exams.Add(id, exam);

Expand Down
4 changes: 2 additions & 2 deletions LangLang/Repositories/PenaltyPointRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void Save()
point.StudentId.ToString(),
point.TutorId.ToString(),
point.CourseId.ToString(),
point.Date.ToString());
point.Date.ToString(Constants.DATE_TIME_FORMAT));
});

File.WriteAllLines(_filePath, lines);
Expand All @@ -98,7 +98,7 @@ public Dictionary<int, PenaltyPoint> Load()
int studentId = int.Parse(values[1]);
int tutorId = int.Parse(values[2]);
int courseId = int.Parse(values[3]);
DateTime date = DateTime.Parse(values[4]);
DateTime date = DateTime.ParseExact(values[4], Constants.DATE_TIME_FORMAT, null);
PenaltyPoint point = new PenaltyPoint( id, studentId, tutorId, courseId, date);
points.Add(point.Id, point);

Expand Down

0 comments on commit 554e936

Please sign in to comment.