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

The due date isn't autofilled anymore, if the lesson is not in the timetable #1135

Closed
nilsreichardt opened this issue Oct 26, 2023 · 2 comments · Fixed by #1136
Closed

The due date isn't autofilled anymore, if the lesson is not in the timetable #1135

nilsreichardt opened this issue Oct 26, 2023 · 2 comments · Fixed by #1136
Labels
bug Something isn't working. feature: homework w: add-homework-page Creation Dialog of a homework. Get to it by pressing the add homework button on the homework page.

Comments

@nilsreichardt
Copy link
Member

Describe the bug

If a course is not present in the timetable, the autofill for the due date of the homework doesn't work anymore.

Steps to reproduce the bug

  1. Go to the homework tab
  2. Click "Create homework"
  3. Select a course that is not in the timetable

Current broken behavior

No due date is autofilled.

Expected behavior

In previous versions, if the course is not present in the timetable, we just used the next day as a due date.

Screenshots, videos or logs

v.mp4

Tested device

  • Device: MacBook Pro M1
  • OS: macOS 13.6
  • App type: macOS
  • App version: Alpha 1.7.9 (600), 90d4bd3

Additional context

cc: @Jonas-Sander

Possible solution

@nilsreichardt nilsreichardt added bug Something isn't working. feature: homework w: add-homework-page Creation Dialog of a homework. Get to it by pressing the add homework button on the homework page. labels Oct 26, 2023
@Jonas-Sander
Copy link
Collaborator

In previous versions, if the course is not present in the timetable, we just used the next day as a due date.

Was it the next day (tomorrow) or the next school day? (So if tomorrow is the weekend or the next days are holidays they are skipped)

@Jonas-Sander
Copy link
Collaborator

Jonas-Sander commented Oct 26, 2023

https://github.com/SharezoneApp/sharezone-app/blob/3ae53ff39e3021c031e60aa9661ee3d76a313690/app/lib/blocs/homework/homework_dialog_bloc.dart#L175C1-L187C4

  static DateTime _getSeedTodoUntilDate() {
    DateTime now =
        DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day);
    if (DateTime.now().weekday == DateTime.friday ||
        DateTime.now().weekday == DateTime.saturday) {
      DateTime monday = now.add(
          Duration(days: DateTime.now().weekday == DateTime.friday ? 3 : 2));
      return monday;
    } else {
      DateTime tomorrow = now.add(const Duration(days: 1));
      return tomorrow;
    }
  }

This seems to be the algorithm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. feature: homework w: add-homework-page Creation Dialog of a homework. Get to it by pressing the add homework button on the homework page.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants