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

Added enrollment question check to CourseModulePermissionBase #1080

Conversation

EerikSaksi
Copy link
Contributor

Before, the permission check would work by simply checking whether the module had opened yet. With this check, the module opening time is only checked if the exercise is not an enrollment question

Fixes #679

Description

What?

This change adds a check for if the exercise is an enrolment question to CourseModulePermissionBase.

Why?

Enrolment questions should be accessible before the module is open

How?

Before the check for if the module is open, we check whether the exercise is an enrolment question. If this is the case, then we do not care if the module is open.

Fixes #679

Testing

Remember to add or update unit tests for new features and changes.

What type of test did you run?

  • Accessibility test using the WAVE extension.
  • Django unit tests.
  • Selenium tests.
  • Other test. (Add a description below)
  • Manual testing.

Ensuring that students can open the URL to enrolment exercises in modules which have not opened yet, making sure that no error is thrown when the view supplied to CourseModulePermissionBase does not have a exercise attribute (when called from ModuleView and not ExerciseView)

Did you test the changes in

  • Chrome
  • Firefox
  • This pull request cannot be tested in the browser.

Think of what is affected by these changes and could become broken

Translation

Programming style

  • Did you follow our style guides?
  • Did you use Python type hinting in all functions that you added or edited? (type hints for function parameters and return values)

Have you updated the README or other relevant documentation?

  • documents inside the doc directory.
  • README.md.
  • Aplus Manual.
  • Other documentation (mention below which documentation).

Is it Done?

  • Reviewer has finished the code review
  • After the review, the developer has made changes accordingly
  • Customer/Teacher has accepted the implementation of the feature

Clean up your git commit history before submitting the pull request!

Copy link
Contributor

@PasiSa PasiSa left a comment

Choose a reason for hiding this comment

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

One style-related proposal, otherwise looks good to me. Didn't test this PR (or my proposal), though.

@EerikSaksi EerikSaksi force-pushed the enrollment-questionaire-module-opening-time branch from ea2a751 to 9943e44 Compare September 20, 2022 11:01
@EerikSaksi
Copy link
Contributor Author

Changed the formatting and added LearningObject import @PasiSa

@markkuriekkinen markkuriekkinen self-assigned this Sep 21, 2022
Copy link
Contributor

@markkuriekkinen markkuriekkinen left a comment

Choose a reason for hiding this comment

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

Good start! When I tested this, I noticed that it really does not work yet because there is also another permission (ExerciseVisiblePermissionBase) that checks the module opening time. Fixing that other permission is easy. I also thought that some details could be formatted better. CourseModulePermissionBase.has_object_permission() has the part module.requirements.exists() in the end that should not be used in enrollment questionnaires.

I made some changes myself and pushed them to git so that you may finalize this PR.

git commit message

  • commit message heading: use the imperative mood
  • line length: at most 80 characters
  • the heading could be reworded better. Emphasize the goal ("enrollment questionnaires should not be affected by the module opening time") instead of the implementation details on the code lines ("check in CourseModulePermissionBase").

@EerikSaksi
Copy link
Contributor Author

Thanks @Mankro for the feedback, I will get to it!

@EerikSaksi EerikSaksi force-pushed the enrollment-questionaire-module-opening-time branch from 8178f40 to da30fda Compare September 22, 2022 07:33
@EerikSaksi
Copy link
Contributor Author

I tested the new changes, it seems like the enrolment questionnaire is accessible before the course is open, but the course is not. I am not sure if this is the desired behaviour.

2022-09-23.16-49-36.mp4

@jsorva
Copy link

jsorva commented Sep 23, 2022

it seems like the enrolment questionnaire is accessible before the course is open, but the course is not. I am not sure if this is the desired behaviour.

I haven’t studied this issue / PR properly at all, but I’ll just mention that AFAIC, it shouldn’t be possible to fill in or even see the enrollment questionnaire before the course is actually open.

@markkuriekkinen
Copy link
Contributor

it seems like the enrolment questionnaire is accessible before the course is open, but the course is not. I am not sure if this is the desired behaviour.

I haven’t studied this issue / PR properly at all, but I’ll just mention that AFAIC, it shouldn’t be possible to fill in or even see the enrollment questionnaire before the course is actually open.

If I remember correctly, the enrollment questionnaire is supposed to be open if the course settings (enrollment starting time and enrollment ending time) define so. If the teacher wants to set enrollment starting time before the course opening time, then it is possible.

If the enrollment opening times are not defined, they default to the course opening times.

If the enrollments are fetched from Sisu, we should check what happens. Is access restricted by the course opening times?

@EerikSaksi
Copy link
Contributor Author

I added a test for accessing the enrollment exercise which tests combinations of starting times and enrollment starting times which passes. I might have misunderstood what the expected behavior is but if the test describes the expected behavior then this should work.

Enrollment questionnaires should not be affected by module opening
times because there are separate course settings for
the enrollment start and end times.

Fixes apluslms#679

Co-authored-by: Markku Riekkinen <markku.riekkinen@aalto.fi>
@markkuriekkinen markkuriekkinen force-pushed the enrollment-questionaire-module-opening-time branch from 0067ae0 to 4e9f956 Compare October 17, 2022 19:39
Copy link
Contributor

@markkuriekkinen markkuriekkinen left a comment

Choose a reason for hiding this comment

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

Good job with the unit tests! I added some more tests, rebased and now I am merging this.

@markkuriekkinen markkuriekkinen merged commit b3b1e0a into apluslms:master Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Enrollment questionnaire is affected by the module opening time
4 participants