Skip to content

Commit

Permalink
Remove unused logic.
Browse files Browse the repository at this point in the history
Fixes #495
  • Loading branch information
mblayman committed Oct 15, 2024
1 parent 0cab3ac commit 447bc5c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
2 changes: 1 addition & 1 deletion homeschool/core/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def test_weekly(self, timezone):
task_3 = CourseTaskFactory(course=course)
task_4 = CourseTaskFactory(course=course)

with self.login(user), self.assertNumQueries(20):
with self.login(user), self.assertNumQueries(19):
self.get("core:weekly", year=2020, month=1, day=27)

expected_schedule = {
Expand Down
23 changes: 0 additions & 23 deletions homeschool/students/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,29 +232,6 @@ def _get_course_task_index(self, course, today, week_start_date, school_year):
return 0

this_week = Week(today)
latest_coursework = (
Coursework.objects.filter(student=self, course_task__course=course)
.order_by("-completed_date")
.first()
)
if latest_coursework and (
this_week.first_day <= latest_coursework.completed_date
):
start_date = latest_coursework.completed_date + datetime.timedelta(days=1)
else:
# When the student has no coursework yet, the counting should start
# from the week start date relative to today.
start_date = this_week.first_day

# Clamp the start to the school year's start.
# This is an edge case that appears when looking at future school years.
if start_date < school_year.start_date:
# This line is not covered, but the problem is tied to #495
# Ignore the line in coverage for the moment.
start_date = school_year.start_date # pragma: no cover

# TODO: Why is start_date not used? See #495

last_school_day_this_week = school_year.last_school_day_for(this_week)
is_current_week_active = today <= last_school_day_this_week
if is_current_week_active:
Expand Down

0 comments on commit 447bc5c

Please sign in to comment.