Skip to content

Commit

Permalink
Code improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
DGoiana authored and bdmendes committed Sep 23, 2023
1 parent 27d91a4 commit 7b18d12
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions uni/lib/model/entities/lecture.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,25 @@ class Lecture {
String subject,
String typeClass,
DateTime day,
String startTime,
String startTimeString,
int blocks,
String room,
String teacher,
String classNumber,
int occurrId,
) {
final startTimeHours = int.parse(startTime.substring(0, 2));
final startTimeMinutes = int.parse(startTime.substring(3, 5));
final endTimeHours =
(startTimeMinutes + (blocks * 30)) ~/ 60 + startTimeHours;
final endTimeMinutes = (startTimeMinutes + (blocks * 30)) % 60;
final startTime = day.add(
Duration(
hours: int.parse(startTimeString.substring(0, 2)),
minutes: int.parse(startTimeString.substring(3, 5)),
),
);
final endTime = startTime.add(Duration(minutes: 30 * blocks));
return Lecture(
subject,
typeClass,
day.add(Duration(hours: startTimeHours, minutes: startTimeMinutes)),
day.add(
Duration(
hours: endTimeHours,
minutes: endTimeMinutes,
),
),
startTime,
endTime,
blocks,
room,
teacher,
Expand Down

0 comments on commit 7b18d12

Please sign in to comment.