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

feat: add Waffle Flag to disable resetting self-paced deadlines by learners #32148

Merged

Conversation

Agrendalath
Copy link
Member

@Agrendalath Agrendalath commented Apr 27, 2023

Description

Currently, relative dates in self-paced courses cannot be enforced. When an assignment's due date is in the past, a learner can click a button to reset these deadlines.

This adds a course_experience.relative_dates_disable_reset flag to disable this behavior. This way, self-paced courses can have real deadlines.

Testing instructions (the order is important)

  1. Add the following Waffle Flags (with Everyone: Yes):
    1. studio.custom_relative_dates
    2. course_experience.relative_dates
    3. course_experience.relative_dates_disable_reset
  2. Go to Course_Date_Signals -> Self paced relative dates configs and add a config with Enabled: Yes.
  3. Create a new course in Studio.
  4. Go to Settings -> Schedule & Details and set the pacing to Self-Paced. Click "Save Changes".
  5. Set a past Course Start Date. Click "Save Changes".
  6. Create a new subsection in the course. Mark it as graded as "Homework" and set "Due in" to 1 week.
  7. Create a Problem Block (e.g., Checkboxes) in the subsection and publish it.
  8. Log in as an audit user and enroll yourself in a course.
  9. Go to the Problem and check if the Submit button is enabled when you select the input fields.
  10. As an admin, go to Schedules -> Schedules and find the schedule for the audit user in this new course. Change the Start date to a year ago and Save.
  11. As an audit user, revisit the Problem (refresh the page) and check that the Submit button can no longer be enabled. That should be a "Past due" pill near the due date above this Problem.
  12. You should also see these deadlines on the Course Outline page.

Deadline

"None"

Other information

Private-ref: BB-7349

@Agrendalath Agrendalath self-assigned this Apr 27, 2023
@openedx-webhooks
Copy link

Thanks for the pull request, @Agrendalath!

As a core committer in this repo, you can merge this once the pull request is approved per the core committer reviewer requirements and according to the agreement with your edX Champion.

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core committer labels Apr 27, 2023
self.assert_no_events_were_emitted()

# Test correct post body
response = self.client.post(reverse('course-experience-reset-course-deadlines'), {'course_key': self.course.id})
assert response.status_code == 200
assert enrollment.schedule.start_date < Schedule.objects.get(id=enrollment.schedule.id).start_date
Copy link
Member Author

Choose a reason for hiding this comment

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

This test wasn't working correctly before. The course wasn't self-paced, so the schedule was never modified.

@@ -25,17 +27,22 @@ def setUp(self): # pylint: disable=arguments-differ
# Need to supply tracker name for the EventTestMixin. Also, EventTestMixin needs to come
# first in class inheritance so the setUp call here appropriately works
super().setUp('openedx.features.course_experience.api.v1.views.tracker')
self.course = CourseFactory.create(self_paced=True, start=timezone.now() - datetime.timedelta(days=1000))
Copy link
Member Author

Choose a reason for hiding this comment

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

I changed days to 1000 because of this check.

Copy link
Member

@farhaanbukhsh farhaanbukhsh left a comment

Choose a reason for hiding this comment

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

👍

  • ✅ I tested this: on master devstack following the instructions
  • ✅ I read through the code
  • ❌ I checked for accessibility issues
  • ✅ Includes documentation
  • ❌ I made sure any change in configuration variables is reflected in the corresponding client's configuration-secure repository.

@Agrendalath Agrendalath merged commit b91f858 into openedx:master May 4, 2023
44 checks passed
@Agrendalath Agrendalath deleted the agrendalath/enforce_relative_dates branch May 4, 2023 15:20
@openedx-webhooks
Copy link

@Agrendalath 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core committer open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants