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

Athena: Allow feedback suggestion module selection on exercise level #7809

Merged
merged 51 commits into from
Mar 9, 2024

Conversation

maximiliansoelch
Copy link
Member

@maximiliansoelch maximiliansoelch commented Dec 19, 2023

Warning

This PR includes a migration! Do not deploy to a normal test server. Instead, deploy to https://ma-schwind.ase.cit.tum.de

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • I followed the coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I added pre-authorization annotations according to the guidelines and checked the course groups for all new REST Calls (security).
  • I documented the Java code using JavaDoc style.

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data.
  • I followed the coding and design guidelines.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Motivation and Context

Currently, the used modules for the feedback selection (Athena) are set in the application's config file. This is very limiting as instructors can not select their desired Athena module individually for each exercise of their course.

Description

This PR allows instructors to select an individual Athena module for each text/programming exercise (Athena currently only supports these two exercise types):

  1. It fetches all available feedback suggestion modules directly from Athena
  2. Admins can specify restricted Athena modules via the configuration files. These restricted modules are only available for a course in case the access is explicitly granted on the course settings page (only visible for admins).
  3. In case a course does not has access to the restricted modules, they get filtered out from the list retrieved in step 1.
  4. New endpoints are added to retrieve the (filtered) module lists (each for every exercise type).
  5. The client displays a new dropdown menu allowing instructors to select one of the modules.
  6. Checks are added to the create/update/import endpoints of the text/programming exercises.
  7. In case the access to the restricted modules is later on revoked by an admin, all the exercises that use a restricted module are updated and their suggestions module is set to null (= suggestions disabled).

The required config-changes are adapted in this PR for ansible: ls1intum/artemis-ansible-collection#62

Steps for Testing

Prerequisites:

  • PR deployed on ma-schwind testserver
  • 1 Admin

Test Case - Course creation

  1. As admin, navigate to the new course creation page
  2. Do not check the checkbox to disable access to restricted Athena modules for the new course (see screenshots for checkbox location)
  3. Create the course
  4. On the course overview page, there should be new info about the state of the Athena access (see screenshots for info location)
  5. Make sure that the Athena access is set to No

Test Case - Change access to restricted Athena modules

  1. Now, edit the course settings and set the restricted Athena checkbox to enabled and save the changes
  2. Once again, make sure that the state of the Athena access is now set to Yes

Test Case - Text Exercise Creation

  1. On the exercise page, click on the button to create a new text exercise
  2. On the exercise creation page, tick the box to enable feedback suggestions for the exercise
  3. A new dropdown should appear, showing a list of available Athena modules that can be used for the feedback suggestion generation
  4. Depending on the course's state of the Athena access, there should be different modules listed:
  • restricted Access enabled: module_text_cofee, module_text_llm
  • restricted Access disabled: module_text_cofee
  1. Select one of the available modules and create the exercise
  2. On the exercise detail page, there should be information displayed if feedback suggestions are enabled
  3. You should also edit the exercise and choose different modules/disable feedback suggestions and make sure the changes are persisted

Test Case - Programming Exercise Creation

  1. Now, do the same steps as for the text exercise for a programming exercise
  2. One difference for programming exercises is that you need to set a due date and set the assessment mode to manual. Otherwise, Athena can not be enabled.
  3. Depending on the course's state of the Athena access, there should be different modules listed:
  • restricted Access enabled: module_example, module_programming_themisml, module_programming_llm
  • restricted Access disabled: module_example, module_programming_themisml

Test Case - Revoke Access to restricted Athena modules

Prerequisites:

  • The course has access to restricted Athena modules
  • 1 Text + Programming Exercise with a restricted module selected
  • 1 Text + Programming Exercise with an unrestricted module selected
  1. Edit the course and revoke the access to the restricted Athena modules for the course
  2. Save the course
  3. Make sure that the exercises with the restricted modules have been updated and the feedback suggestions have been disabled
  4. Make sure that the exercises with the unrestricted modules have not been changed and the feedback suggestions are still enabled

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

Test Coverage

Client

Class/File Line Coverage Confirmation (assert/expect)
app.constants.ts 100%
athena.service.ts 91.93%
course-update.component.ts 87.5%
course-detail.component.ts 86.04%
course.model.ts 100%
exercise.model.ts 93.82%
programming-exercise-lifecycle.component.ts 95.71%
exercise-feedback-suggestion-options.component.ts 90%

Server

Class/File Line Coverage Confirmation (assert/expect)
Course.java 91%
Exercise.java 93%
ExerciseRepository.java 67%
SubmissionService.java 90%
TextExerciseImportService.java 100%
AthenaFeedbackSendingService.java 94%
AthenaFeedbackSuggestionsService.java 100%
AthenaModuleService.java 89%
AthenaRepositoryExportService.java 92%
AthenaSubmissionSelectionService.java 100%
AthenaSubmissionSendingService.java 92%
ProgrammingExerciseImportService.java 98%
AthenaScheduleService.java 47%
AthenaResource.java 88%
CourseResource.java 95%
ProgrammingAssessmentResource.java 89%
ProgrammingExerciseExportImportResource.java 96%
ProgrammingExerciseResource.java 90%
TextAssessmentResource.java 90%
TextExerciseResource.java 96%

Screenshots

Added checkbox in the course edit view to allow a course the usage of restricted Athena modules:
image

Added dropdown to select Athena module when creating or updating a programming exercise:
image

Added dropdown to select Athena module when creating or updating a text exercise:
image

Summary by CodeRabbit

  • New Features
    • Enhanced feedback suggestion capabilities by introducing a module-based system to replace the previous boolean flag, enabling more granular control over feedback suggestions.
    • Added support for restricted Athena modules, including the ability for admins to toggle access on a course basis.
    • Updated various components to integrate with the new feedback suggestion module system and Athena module service, improving the user interface and experience related to feedback suggestions and Athena modules management.
  • Bug Fixes
    • Corrected the logic in several services to properly check for enabled feedback suggestions using the new module-based system.
  • Refactor
    • Replaced boolean fields related to feedback suggestions with a more flexible string field to accommodate the module-based system.
    • Updated method signatures and queries to align with the new feedback suggestion module system.
  • Style
    • Updated web components to reflect changes in feedback suggestions and Athena module management, including new UI elements for enabling restricted Athena modules access and displaying feedback suggestion settings in exercise details.

…-exercises

# Conflicts:
#	src/main/webapp/app/course/manage/course-update.component.html
#	src/main/webapp/app/course/manage/detail/course-detail.component.html
#	src/main/webapp/app/exercises/programming/manage/programming-exercise-detail.component.html
#	src/main/webapp/app/exercises/programming/shared/lifecycle/programming-exercise-lifecycle.component.html
#	src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-detail.component.html
#	src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-update.component.html
@artemis-bot artemis-bot added this to In progress in Artemis Development Dec 19, 2023
@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!) database Pull requests that update the database. (Added Automatically!). Require a CRITICAL deployment. config-change Pull requests that change the config in a way that they require a deployment via Ansible. labels Dec 19, 2023
Copy link

coderabbitai bot commented Dec 29, 2023

Walkthrough

This update introduces a shift from a Boolean feedbackSuggestionsEnabled field to a feedbackSuggestionModule String field in exercises, enhancing the feedback suggestion mechanism. It includes backend and frontend modifications to support this change, integrates Athena module services for exercise feedback, and extends course management to handle restricted Athena modules. The adjustments aim to refine feedback suggestion capabilities and manage Athena module access effectively.

Changes

File Path Change Summary
.../domain/Exercise.java Replaced feedbackSuggestionsEnabled with feedbackSuggestionModule; added isFeedbackSuggestionsEnabled method.
.../repository/ExerciseRepository.java Updated imports, method signatures; added revokeAccessToRestrictedFeedbackSuggestionModulesByCourseId.
.../service/SubmissionService.java Updated to use isFeedbackSuggestionsEnabled for condition checks.
.../web/rest/*Resource.java Integrated AthenaModuleService; updated feedback suggestion checks and handling.
.../domain/Course.java Added restrictedAthenaModulesAccess field with accessors.
.../service/connectors/athena/AthenaModuleService.java Introduced to handle Athena module fetching and access.
src/main/webapp/app/... Updated to support new feedback suggestion mechanism and Athena module management.
.../service/TextExerciseImportService.java Updated import logic to use feedbackSuggestionModule.
.../spec/component/course/course-update.component.spec.ts Extended test to include restrictedAthenaModulesAccess functionality.

Related issues

  • Programming exercises: Add Athena Feedback Suggestions #7094: The changes in this PR could potentially address the objectives of extending Athena's capability to provide feedback suggestions for programming exercises by integrating a more flexible feedbackSuggestionModule field and managing Athena module access, which is fundamental for enabling such features across different types of exercises.

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@maximiliansoelch
Copy link
Member Author

Manual test

On the exercise detail page, there should be information displayed if feedback suggestions are enabled and if yes, which module is selected (see screenshots for location)

The check mark will be shown properly, although the module name will be shown neither on the programming, nor on the text exercises page

Yes, that's the intended behavior right now. The UI changed over the course of this PR, and therefore the code had to be adjusted. I updated the PR description

marlon-luca-bu
marlon-luca-bu previously approved these changes Feb 23, 2024
undernagruzez
undernagruzez previously approved these changes Feb 23, 2024
@maximiliansoelch maximiliansoelch added this to the 6.8.2 milestone Feb 23, 2024
@krusche krusche modified the milestones: 6.8.2, 6.9.0 Feb 26, 2024
@krusche krusche removed this from the 6.9.0 milestone Mar 2, 2024
…-exercises

# Conflicts:
#	src/main/java/de/tum/in/www1/artemis/repository/ExerciseRepository.java
#	src/test/javascript/spec/component/course/course-update.component.spec.ts
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

@maximiliansoelch maximiliansoelch added this to the 6.9.1 milestone Mar 4, 2024
@krusche krusche merged commit 562fed0 into develop Mar 9, 2024
30 of 37 checks passed
@krusche krusche deleted the feature/athena/allow-module-selection-for-exercises branch March 9, 2024 15:28
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!) config-change Pull requests that change the config in a way that they require a deployment via Ansible. database Pull requests that update the database. (Added Automatically!). Require a CRITICAL deployment. ready to merge server Pull requests that update Java code. (Added Automatically!) tests too-long-open !!! This is an antipattern, we should aim for small PRs that are only open for a short time !!!
Projects
No open projects
Artemis Development
  
Review in progress
Development

Successfully merging this pull request may close these issues.

None yet

6 participants