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

Exam mode: Generate student exam on demand if student is registered for the exam #9123

Merged

Conversation

coolchock
Copy link
Contributor

@coolchock coolchock commented Jul 26, 2024

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • I strictly followed the server coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I documented the Java code using JavaDoc style.

Motivation and Context

Currently, student exams can only be generated on demand for test exams, but not for real exams. This limitation can be problematic if additional students are registered for the exam and the instructor forgets to click Generate missing student exams. If this oversight is discovered after the exam has started, the only way to allow the student to participate is to duplicate the exam and register the missing students for the new one. This pull request adds a feature to generate student exams on demand for real exams as well.
resolves #3835

Description

The condition for allowing a student to generate a student exam (previously applicable only to test exams) has been extended to include a check to see if the student is registered for the exam. Now, a student exam will be generated if the exam is a test exam OR if the student is registered for the exam. This is possible only starting from 5 minutes before the exam to prevent inconsistencies, such as an instructor adding another exercise group after a student has generated their exam on demand.

Furthermore, if a student is registered for the exam after the exam has started, a student exam is now generated automatically.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 2 Students
  • 1 Exam
  1. Log in to Artemis
  2. Navigate to Course Administration -> Exam Management as an instructor.
  3. Register the first student for the exam before the exam start date, but do not generate the student exam.
  4. Set the exam visibility date and exam start time so that the exam page is accessible to students more than 5 minutes before the exam starts.
  5. Access the exam page as a student more than 5 minutes before the exam start time and verify that you see an error stating you are not registered for the exam.
  6. Wait until there are less than 5 minutes before the exam start time, go to the exam page again, and verify that no error is displayed and that a student exam is generated. Also, verify this as an instructor under the "Student Exams" section in Exam Management.
  7. Return to the instructor account and register the second student for the exam after the exam has started.
  8. As an instructor, verify under the "Student Exams" section in Exam Management that the second student's exam has been generated.
  9. As the second student, verify that you can participate in the exam.

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced flexibility for generating student exams based on registration status, allowing access for both test and normal exams.
    • Improved student exam registration process to accommodate late registrations, ensuring all students can access necessary exam materials.
  • Bug Fixes

    • Improved clarity of error messages related to student registration for exams, making it easier for users to understand registration issues.
  • Tests

    • Added new test cases to cover various user registration scenarios for exam access.
    • Enhanced integration tests to verify the correct generation of student exams upon registration.

@github-actions github-actions bot added the server Pull requests that update Java code. (Added Automatically!) label Jul 26, 2024
Copy link

github-actions bot commented Aug 2, 2024

There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Aug 2, 2024
@github-actions github-actions bot removed the stale label Aug 8, 2024
@dfuchss
Copy link
Contributor

dfuchss commented Aug 11, 2024

Does this resolve #3835 as well?

@github-actions github-actions bot added the tests label Aug 14, 2024
@coolchock coolchock temporarily deployed to artemis-test3.artemis.cit.tum.de August 14, 2024 21:22 — with GitHub Actions Inactive
@coolchock coolchock marked this pull request as ready for review August 14, 2024 22:26
@coolchock coolchock requested a review from a team as a code owner August 14, 2024 22:26
Copy link

coderabbitai bot commented Aug 14, 2024

Walkthrough

The changes enhance the functionality of the ExamAccessService and ExamRegistrationService classes, allowing for the generation of student exams for both test exams and registered students. Modifications improve error handling and registration logic, enabling the registration of students even after the exam has started.

Changes

File Path Change Summary
src/main/java/de/tum/in/www1/artemis/service/exam/ExamAccessService.java Refactored getExamInCourseElseThrow to allow exam generation for registered students and test exams, enhancing error handling and clarity.
src/main/java/de/tum/in/www1/artemis/service/exam/ExamRegistrationService.java Added dependency for StudentExamService to manage individual student exam generation; updated registration logic to accommodate exam participation after start.
src/test/java/de/tum/in/www1/artemis/exam/ExamRegistrationIntegrationTest.java Introduced tests to validate StudentExam generation upon student registration, checking state pre- and post-registration.
src/test/java/de/tum/in/www1/artemis/service/exam/ExamAccessServiceTest.java Enhanced test cases to cover scenarios for registered users without student exams and improved assertions for exam access logic.

Assessment against linked issues

Objective Addressed Explanation
Add participants after exam start (#3835) The changes implement functionality to generate individual exams for students registering after the exam has started.
Generate individual exams for newly added students The modifications ensure that individual exams can be generated for students added after the exam starts.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coolchock
Copy link
Contributor Author

@dfuchss yes, it does. Students can be added to an exam after it has started, and their individual student exams will be generated on demand. It's also possible to adjust individual working time.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 15, 2024
dfuchss
dfuchss previously approved these changes Aug 15, 2024
Copy link
Contributor

@dfuchss dfuchss left a comment

Choose a reason for hiding this comment

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

Code

pzdr7
pzdr7 previously approved these changes Sep 13, 2024
Copy link
Contributor

@pzdr7 pzdr7 left a comment

Choose a reason for hiding this comment

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

Reapprove after merge conflict

JohannesStoehr
JohannesStoehr previously approved these changes Sep 14, 2024
Copy link
Contributor

@JohannesStoehr JohannesStoehr left a comment

Choose a reason for hiding this comment

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

Reapprove after merge conflicts

dfuchss
dfuchss previously approved these changes Sep 15, 2024
Copy link
Contributor

@dfuchss dfuchss left a comment

Choose a reason for hiding this comment

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

Re-Approve

@krusche krusche modified the milestones: 7.5.3, 7.5.4 Sep 18, 2024
@krusche krusche modified the milestones: 7.5.4, 7.5.5, 7.5.6 Sep 27, 2024
…sing-student-exams-on-demand

# Conflicts:
#	src/test/java/de/tum/cit/aet/artemis/exam/service/ExamAccessServiceTest.java
@github-actions github-actions bot added the exam Pull requests that affect the corresponding module label Oct 1, 2024
Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

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

reapprove

Copy link
Contributor

@undernagruzez undernagruzez left a comment

Choose a reason for hiding this comment

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

reapprove

Copy link
Contributor

@JohannesStoehr JohannesStoehr left a comment

Choose a reason for hiding this comment

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

Reapprove after merge conflicts

@krusche krusche modified the milestones: 7.5.6, 7.6.0 Oct 5, 2024
Copy link
Member

@krusche krusche left a comment

Choose a reason for hiding this comment

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

Code looks good to me 👍

@krusche krusche merged commit 6deb17c into develop Oct 12, 2024
12 of 18 checks passed
@krusche krusche deleted the feature/exam-mode/generate-missing-student-exams-on-demand branch October 12, 2024 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exam Pull requests that affect the corresponding module ready to merge server Pull requests that update Java code. (Added Automatically!) small tests
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

Exams: Add Participants after Exam start