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: Remove author from exam live events #10422

Merged
merged 12 commits into from
Mar 9, 2025

Conversation

coolchock
Copy link
Contributor

@coolchock coolchock commented Feb 27, 2025

Checklist

General

Server

Client

Motivation and Context

Together with @krusche, we decided to remove the author from live exam events as this information is unnecessary. Additionally, this PR fixes an issue where the @CreatedBy annotation did not correctly capture the user due to the @Async annotation interfering with AuthenticationContext propagation.

Description

I removed the author from live exam events and removed the @Async annotation so that AuthenticationContext is properly propagated and @CreatedBy can be used as intended.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Students
  • 1 Exam with one exercise different than quiz
  1. Log in to Artemis as a Student in one browser.
  2. Log in to Artemis as an Instructor in another browser.
  3. As a Student, start the exam.
  4. As an Instructor, navigate to:
  5. Course Management → Exams → Select an Exam → Exercise Groups → Select an Exercise.
  6. Edit the problem statement of an exercise and save the changes.
  7. As a Student, verify that you received a problem statement update and the author is not displayed in the top-right corner of the modal.

Testserver States

You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.

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 even for very large courses with more than 2000 students.
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance even for very large courses with more than 2000 students.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2
image

Summary by CodeRabbit

  • Refactor
    • Streamlined exam event notifications and announcements by removing creator/author information.
    • Updated live event dialogs now omit the “from” label, offering a cleaner and more concise view.
    • Adjusted exam event handling to process problem statement updates synchronously, enhancing consistency in event notifications.

@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) playwright exam Pull requests that affect the corresponding module labels Feb 27, 2025
@github-actions github-actions bot added the exercise Pull requests that affect the corresponding module label Feb 28, 2025
@coolchock coolchock marked this pull request as ready for review March 2, 2025 10:45
@coolchock coolchock requested a review from a team as a code owner March 2, 2025 10:45
@coolchock coolchock added the small label Mar 2, 2025
Copy link

coderabbitai bot commented Mar 2, 2025

Walkthrough

The changes remove the createdBy information from several event-related classes, DTOs, UI components, and tests. Methods converting events to DTOs no longer include the creator parameter, and related DTO declarations have been updated accordingly. Additionally, a service method’s asynchronous behavior has been changed to execute synchronously, and UI elements as well as localization keys associated with the author are removed. The tests have been updated to no longer check for creator information in events and modal dialogs.

Changes

File(s) Change Summary
src/main/java/de/tum/cit/aet/artemis/exam/domain/event/ExamAttendanceCheckEvent.java
src/main/java/de/tum/cit/aet/artemis/exam/domain/event/ExamWideAnnouncementEvent.java
src/main/java/de/tum/cit/aet/artemis/exam/domain/event/ProblemStatementUpdateEvent.java
src/main/java/de/tum/cit/aet/artemis/exam/domain/event/WorkingTimeUpdateEvent.java
Modified asDTO() methods to remove the createdBy parameter from DTO constructor calls.
src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ExamAttendanceCheckEventDTO.java
src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ExamWideAnnouncementEventDTO.java
src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ProblemStatementUpdateEventDTO.java
src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/WorkingTimeUpdateEventDTO.java
src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ExamLiveEventBaseDTO.java
Removed the createdBy field/method from DTO record declarations and interfaces.
src/main/java/de/tum/cit/aet/artemis/exam/service/ExamLiveEventsService.java
src/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseService.java
Removed @Async from an event creation method and eliminated retrieval of instructor data in exercise change notifications.
src/main/webapp/app/exam/manage/exams/exam-checklist-component/exam-announcement-dialog/exam-live-announcement-create-modal.component.ts
src/main/webapp/app/exam/participate/exam-participation-live-events.service.ts
src/main/webapp/app/exam/shared/events/exam-live-event.component.html
src/main/i18n/{de,en}/exam.json
Removed dependency on AccountService and references to createdBy in UI components and templates, and deleted localization keys related to “from”.
src/test/** (Multiple test files across Java, JavaScript, and Playwright) Eliminated assertions and checks related to the createdBy property in events, modal dialogs, and mock objects. Additionally, removed the checkDialogAuthor method from a page object.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant ExamLiveEventsService
    participant EventDTO

    Caller->>ExamLiveEventsService: createAndSendProblemStatementUpdateEvent(exercise, message)
    Note right of ExamLiveEventsService: Now executes synchronously (removal of @Async)
    ExamLiveEventsService->>EventDTO: Construct EventDTO (without createdBy)
    ExamLiveEventsService->>Caller: Return control after processing

Possibly related PRs

Suggested labels

small, ready to merge, core


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 93eba08 and c777223.

📒 Files selected for processing (23)
  • src/main/java/de/tum/cit/aet/artemis/exam/domain/event/ExamAttendanceCheckEvent.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/exam/domain/event/ExamWideAnnouncementEvent.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/exam/domain/event/ProblemStatementUpdateEvent.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/exam/domain/event/WorkingTimeUpdateEvent.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ExamAttendanceCheckEventDTO.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ExamLiveEventBaseDTO.java (0 hunks)
  • src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ExamWideAnnouncementEventDTO.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ProblemStatementUpdateEventDTO.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/WorkingTimeUpdateEventDTO.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/exam/service/ExamLiveEventsService.java (0 hunks)
  • src/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseService.java (0 hunks)
  • src/main/webapp/app/exam/manage/exams/exam-checklist-component/exam-announcement-dialog/exam-live-announcement-create-modal.component.ts (0 hunks)
  • src/main/webapp/app/exam/participate/exam-participation-live-events.service.ts (0 hunks)
  • src/main/webapp/app/exam/shared/events/exam-live-event.component.html (0 hunks)
  • src/main/webapp/i18n/de/exam.json (0 hunks)
  • src/main/webapp/i18n/en/exam.json (0 hunks)
  • src/test/java/de/tum/cit/aet/artemis/exam/StudentExamIntegrationTest.java (0 hunks)
  • src/test/javascript/spec/component/exam/shared/events/exam-live-event.component.spec.ts (0 hunks)
  • src/test/javascript/spec/service/exam-participation-live-events.service.spec.ts (0 hunks)
  • src/test/playwright/e2e/exam/ExamParticipation.spec.ts (0 hunks)
  • src/test/playwright/support/pageobjects/exam/ExamManagementPage.ts (0 hunks)
  • src/test/playwright/support/pageobjects/exam/ExamParticipationActions.ts (0 hunks)
  • src/test/playwright/support/pageobjects/exam/ModalDialogBox.ts (0 hunks)
💤 Files with no reviewable changes (15)
  • src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ExamLiveEventBaseDTO.java
  • src/main/webapp/app/exam/shared/events/exam-live-event.component.html
  • src/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseService.java
  • src/main/webapp/app/exam/participate/exam-participation-live-events.service.ts
  • src/test/javascript/spec/service/exam-participation-live-events.service.spec.ts
  • src/main/webapp/i18n/de/exam.json
  • src/test/playwright/support/pageobjects/exam/ExamManagementPage.ts
  • src/test/playwright/e2e/exam/ExamParticipation.spec.ts
  • src/test/playwright/support/pageobjects/exam/ModalDialogBox.ts
  • src/main/webapp/i18n/en/exam.json
  • src/test/playwright/support/pageobjects/exam/ExamParticipationActions.ts
  • src/main/webapp/app/exam/manage/exams/exam-checklist-component/exam-announcement-dialog/exam-live-announcement-create-modal.component.ts
  • src/test/javascript/spec/component/exam/shared/events/exam-live-event.component.spec.ts
  • src/test/java/de/tum/cit/aet/artemis/exam/StudentExamIntegrationTest.java
  • src/main/java/de/tum/cit/aet/artemis/exam/service/ExamLiveEventsService.java
🧰 Additional context used
📓 Path-based instructions (1)
`src/main/java/**/*.java`: naming:CamelCase; principles:{sin...

src/main/java/**/*.java: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports

  • src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ExamWideAnnouncementEventDTO.java
  • src/main/java/de/tum/cit/aet/artemis/exam/domain/event/ExamWideAnnouncementEvent.java
  • src/main/java/de/tum/cit/aet/artemis/exam/domain/event/WorkingTimeUpdateEvent.java
  • src/main/java/de/tum/cit/aet/artemis/exam/domain/event/ExamAttendanceCheckEvent.java
  • src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/WorkingTimeUpdateEventDTO.java
  • src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ExamAttendanceCheckEventDTO.java
  • src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ProblemStatementUpdateEventDTO.java
  • src/main/java/de/tum/cit/aet/artemis/exam/domain/event/ProblemStatementUpdateEvent.java
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Call Build Workflow / Build .war artifact
  • GitHub Check: Call Build Workflow / Build and Push Docker Image
  • GitHub Check: client-style
  • GitHub Check: client-tests
  • GitHub Check: client-tests-selected
  • GitHub Check: server-style
  • GitHub Check: server-tests
  • GitHub Check: Analyse
🔇 Additional comments (9)
src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ExamWideAnnouncementEventDTO.java (1)

11-11: LGTM - Removed author information from DTO

The removal of the createdBy field from this DTO aligns with the PR objective to eliminate author information from exam live events. The record definition now correctly includes only the essential information needed: id, creation timestamp, and announcement text.

src/main/java/de/tum/cit/aet/artemis/exam/domain/event/ExamWideAnnouncementEvent.java (1)

31-32: LGTM - Consistent change in DTO conversion method

The asDTO() method has been updated to omit the creator information when constructing the DTO, which is consistent with the changes made to the corresponding DTO class.

src/main/java/de/tum/cit/aet/artemis/exam/domain/event/WorkingTimeUpdateEvent.java (1)

60-61: LGTM - Removed author from DTO conversion

The implementation correctly removes the author information from the DTO creation, aligning with the PR objective to eliminate the display of author information during live exam events.

src/main/java/de/tum/cit/aet/artemis/exam/domain/event/ExamAttendanceCheckEvent.java (1)

31-32: LGTM - Consistent implementation of author removal

The asDTO() method has been properly updated to exclude the creator information, maintaining consistency with the other exam event classes and fulfilling the PR objective.

src/main/java/de/tum/cit/aet/artemis/exam/domain/event/ProblemStatementUpdateEvent.java (1)

65-65: Correctly removes author information from DTO

This change aligns with the PR objective of removing author information from exam live events by removing this.getCreatedBy() from the ProblemStatementUpdateEventDTO constructor parameters.

src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/WorkingTimeUpdateEventDTO.java (1)

11-11: Field removed as intended

The removal of the String createdBy field from the record declaration correctly implements the PR objective. This change ensures that author information is no longer part of the DTO's structure.

src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ProblemStatementUpdateEventDTO.java (1)

11-11: Author field correctly removed

The removal of the createdBy field from the record declaration properly implements the PR objective of removing author information from exam events. This change ensures consistency with the updated asDTO() method in the corresponding event class.

src/main/java/de/tum/cit/aet/artemis/exam/dto/examevent/ExamAttendanceCheckEventDTO.java (2)

13-13: Author field correctly removed from record

The removal of the createdBy field from the record declaration aligns with the PR objective of removing author information from exam live events.


16-16: Factory method updated to match record changes

The of static factory method has been correctly updated to no longer pass the creator information to the DTO constructor, maintaining consistency with the modified record declaration.

✨ Finishing Touches
  • 📝 Generate Docstrings

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 generate docstrings to generate docstrings for this 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.

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.

Code makes sense, but please add a screenshot to the description

Copy link
Contributor

@N0W0RK N0W0RK left a comment

Choose a reason for hiding this comment

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

Code LGTM

@helios-aet helios-aet bot temporarily deployed to artemis-test2.artemis.cit.tum.de March 7, 2025 10:49 Inactive
Copy link
Contributor

@magaupp magaupp left a comment

Choose a reason for hiding this comment

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

Tested on TS2. No author shown in event notification, as described.

Copy link
Contributor

@dmytropolityka dmytropolityka left a comment

Choose a reason for hiding this comment

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

Tested on ts2, participated in an exam and received a notification without an author

@helios-aet helios-aet bot temporarily deployed to artemis-test3.artemis.cit.tum.de March 7, 2025 16:00 Inactive
@krusche krusche added this to the 7.10.5 milestone Mar 9, 2025
@krusche krusche merged commit 13aa44c into develop Mar 9, 2025
46 of 48 checks passed
@krusche krusche deleted the chore/exam-mode/remove-author-from-live-event branch March 9, 2025 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) exam Pull requests that affect the corresponding module exercise Pull requests that affect the corresponding module playwright 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.

6 participants