Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed schedule days #1039

Closed
wants to merge 1 commit into from
Closed

Fixed schedule days #1039

wants to merge 1 commit into from

Conversation

eduardagmagno
Copy link
Contributor

Closes #946
Added Saturday tab on schedule page.

Review checklist

  • Terms and conditions reflect the current change
  • Contains enough appropriate tests
  • If aimed at production, writes a new summary in whatsnew/whatsnew-pt-PT
  • Properly adds an entry in changelog.md with the change
  • If PR includes UI updates/additions, its description has screenshots
  • Behavior is as expected
  • Clean, well-structured code

Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Merging #1039 (3beb921) into develop (fbe2129) will decrease coverage by 0%.
Report is 2 commits behind head on develop.
The diff coverage is 100%.

Additional details and impacted files
@@           Coverage Diff           @@
##           develop   #1039   +/-   ##
=======================================
- Coverage       16%     16%   -0%     
=======================================
  Files          207     207           
  Lines         6487    6486    -1     
=======================================
- Hits          1004    1003    -1     
  Misses        5483    5483           

Copy link
Collaborator

@bdmendes bdmendes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice first contribution! Working well on my end.
I left a couple of suggestions to make the code cleaner.

Comment on lines 127 to 128
final allDays = Provider.of<LocaleNotifier>(context).getWeekdaysWithLocale()
..removeAt(6);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of creating a method in the provider related to the relevant work days (e.g. getWorkWeekDaysWithLocale()) and then using it as a private member of this widget class?

Comment on lines 149 to 147
final tabBarViewContent = <Widget>[];
for (var i = 0; i < 5; i++) {
for (var day = 0; day < 6; day++) {
tabBarViewContent
.add(createScheduleByDay(context, i, lectures, scheduleStatus));
.add(createScheduleByDay(context, day, lectures, scheduleStatus));
}
return tabBarViewContent;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can:

  • Inline this logic (it's small and not reusable)
  • Make this declarative (e.g. workDays.map((day) => createSchedule...))

@bdmendes bdmendes requested a review from clarapbsousa December 8, 2023 14:31
@@ -50,7 +50,7 @@ class SchedulePageView extends StatefulWidget {
static List<Set<Lecture>> groupLecturesByDay(List<Lecture> schedule) {
final aggLectures = <Set<Lecture>>[];

for (var i = 0; i < 5; i++) {
for (var i = 0; i < 6; i++) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you get this number without it being hardcoded?


List<String> getWorkWeekDaysWithLocale() {
List<String> allDays = getWeekdaysWithLocale();
allDays.removeAt(6);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary? Is this used to exclude sundays from the schedule?

class SchedulePage extends StatefulWidget {
const SchedulePage({super.key});

@override
SchedulePageState createState() => SchedulePageState();
}

class SchedulePageState extends GeneralPageViewState<SchedulePage> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bdmendes not sure how pages are supposed to be done. Is this right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't, this widget as is will be rendered without a scaffold behind (so black background)

@limwa limwa mentioned this pull request Feb 29, 2024
7 tasks
@bdmendes
Copy link
Collaborator

Superseded by #1172

@bdmendes bdmendes closed this Feb 29, 2024
@DGoiana DGoiana deleted the fix/schedule-days branch June 19, 2024 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show weekend tabs on schedule page
4 participants