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

Programming exercises: Add information box to exercise details page #9668

Merged
merged 23 commits into from
Nov 10, 2024

Conversation

rabeatwork
Copy link
Contributor

@rabeatwork rabeatwork commented Nov 4, 2024

Checklist

General

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 strictly followed the client coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I added authorities to all new routes and checked the course groups for displaying navigation elements (links, buttons).
  • 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

This PR is part of the new design; it enhances usability and aligns with the updated layout.

Description

All important information for an exercise is now displayed in the information boxes at the top. Additionally, the Instructor Actions are consolidated into a dropdown button.
This is a reopened PR of the stale PR #9089: Programming exercises: Add information box to exercise details page.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Students
  • 1 Programming Exercise
  1. Log in to Artemis
  2. Navigate to Exercises
  3. Check differently configured exercises and verify that the information are displayed correctly

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

Test Coverage

Class/File Line Coverage Confirmation (assert/expect)
exam-start-information.component.ts 100%
exercise-headers-information.component.ts 76.47%
result.component.ts 88.88%
updating-result.component.ts 97.05%
course-overview.component.ts 87.15%
submission-result-status.component.ts 100%
code-button.component.ts 93.28%
difficulty-level.component.ts 94.11%
exercise-categories.component.ts 100%
information-box.component.ts 100%
date.utils.ts 100%

Screenshots

Text Future und Kategorie ModelingCurrent Programming + Result Optional Text QuizBewertet

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new ExerciseHeadersInformationComponent to display detailed exercise information.
    • Added a DifficultyLevelComponent for visual representation of difficulty levels.
    • Enhanced rendering logic for exercise categories and submission results.
    • Implemented a new InformationBox structure for better content handling.
    • Added a new input property showCompletion to control the display of completion information in results.
  • Improvements

    • Streamlined the display logic for exercise details and submission policies.
    • Improved localization for submission penalties and titles in multiple languages.
    • Adjusted sidebar and drawer dimensions for better layout consistency.
    • Enhanced the styling of message input areas and card components for improved responsiveness.
    • Updated the navbar and breadcrumb styles for better visual hierarchy and consistency.
  • Bug Fixes

    • Adjusted conditional rendering for completion dates and exercise action buttons.
    • Fixed rendering issues related to the sidebar and exercise detail components.
    • Resolved issues with the visibility of score displays in exercise results.
  • Styling Updates

    • Refined styles for various components, including sidebar and card elements, to improve user experience.
    • Updated styles for message input areas and card components for better responsiveness.
  • Tests

    • Added comprehensive test suites for new components and utility functions to ensure functionality and reliability.
    • Enhanced test coverage for existing components to validate rendering and behavior under various conditions.

@rabeatwork rabeatwork requested a review from a team as a code owner November 4, 2024 08:51
@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) playwright labels Nov 4, 2024
Copy link

coderabbitai bot commented Nov 4, 2024

Walkthrough

The pull request introduces significant modifications across multiple components in the Angular application, primarily focusing on enhancing the handling and display of information related to exams and exercises. Key changes include the restructuring of data types for information boxes, updates to HTML templates for conditional rendering, and the introduction of new components for displaying exercise headers and difficulty levels. Additionally, the styling of various components has been refined, and new utility functions have been added to improve functionality. The overall aim is to enhance the clarity, maintainability, and user experience of the application.

Changes

File Path Change Summary
src/main/webapp/app/exam/participate/exam-start-information/exam-start-information.component.html Modified conditional rendering logic for displaying content based on informationBoxData.content.type, replacing previous checks against contentComponent.
src/main/webapp/app/exam/participate/exam-start-information/exam-start-information.component.ts Enhanced ExamStartInformationComponent with InformationBoxContent type, updating method signatures and data structure for information boxes.
src/main/webapp/app/exercises/shared/exercise-headers/exercise-headers-information/exercise-headers-information.component.html Introduced a new HTML template for exercise header information with conditional rendering based on exercise object and various content types.
src/main/webapp/app/exercises/shared/exercise-headers/exercise-headers-information/exercise-headers-information.component.ts New ExerciseHeadersInformationComponent added to display detailed exercise information, implementing OnInit and OnChanges lifecycle hooks.
src/main/webapp/app/exercises/shared/result/result.component.html Updated conditional rendering logic for completion date and adjusted icon rendering for missing results.
src/main/webapp/app/exercises/shared/result/result.component.ts Added new input property showCompletion to control visibility of completion information.
src/main/webapp/app/exercises/shared/result/updating-result.component.html Added [showCompletion] input property to <jhi-result> component.
src/main/webapp/app/exercises/shared/result/updating-result.component.ts Introduced new input property showCompletion to UpdatingResultComponent class.
src/main/webapp/app/overview/course-conversations/course-conversations.component.scss Adjusted CSS custom properties for message input area heights.
src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.scss Modified CSS custom properties related to message input heights.
src/main/webapp/app/overview/course-overview.component.html Updated conditional rendering logic for sidebar wrapper based on isShownViaLti variable.
src/main/webapp/app/overview/course-overview.component.scss Adjusted height calculations for sidebar and drawer components.
src/main/webapp/app/overview/course-overview.component.ts Added new icons and updated sidebar items dynamically based on course properties. Enhanced error handling in loadCourse method.
src/main/webapp/app/overview/course-overview.component.ts Removed .tab-bar-exercise-details class and associated styles from SCSS files.
src/main/webapp/app/overview/discussion-section/discussion-section.component.scss Modified card header styling and responsive layout adjustments.
src/main/webapp/app/overview/exercise-details/course-exercise-details.component.html Introduced new layout for exercise details, refactoring instructor actions into a dropdown menu.
src/main/webapp/app/overview/exercise-details/course-exercise-details.component.scss Removed .tab-bar-exercise-details class and its styles.
src/main/webapp/app/overview/exercise-details/course-exercise-details.component.ts Added new methods and properties to manage instructor actions and exercise icons.
src/main/webapp/app/overview/exercise-details/course-exercise-details.module.ts Imported ExerciseHeadersInformationComponent into the module.
src/main/webapp/app/overview/exercise-details/exercise-details-student-actions.component.html Enhanced rendering logic for exercise types and action buttons.
src/main/webapp/app/overview/submission-result-status.component.html Added [showCompletion] input property to jhi-updating-result component.
src/main/webapp/app/overview/submission-result-status.component.ts Introduced new input property showCompletion to SubmissionResultStatusComponent.
src/main/webapp/app/shared/components/code-button/code-button.component.html Updated binding for hideLabelMobile property to be dynamic.
src/main/webapp/app/shared/components/code-button/code-button.component.ts Added new input property hideLabelMobile to control visibility of labels on mobile devices.
src/main/webapp/app/shared/components/exercise-action-button.component.html Added [fixedWidth]="true" attribute to icon element for consistent width.
src/main/webapp/app/shared/components/not-released-tag.component.ts Changed noMargin from optional to required boolean input with a default value.
src/main/webapp/app/shared/components/open-code-editor-button/open-code-editor-button.component.html Updated binding of hideLabelMobile property for button elements.
src/main/webapp/app/shared/components/open-code-editor-button/open-code-editor-button.component.ts Added new input property hideLabelMobile to control visibility of labels on mobile devices.
src/main/webapp/app/shared/difficulty-level/difficulty-level.component.html Introduced new component for displaying difficulty level with skill bars and tooltips.
src/main/webapp/app/shared/difficulty-level/difficulty-level.component.scss Added new CSS class for skill bars.
src/main/webapp/app/shared/difficulty-level/difficulty-level.component.ts Implemented DifficultyLevelComponent with dynamic difficulty level handling and translation capabilities.
src/main/webapp/app/shared/exercise-categories/exercise-categories.component.html Updated HTML structure to use <span> elements instead of <h4> for various categories and badges.
src/main/webapp/app/shared/exercise-categories/exercise-categories.component.ts Added new input property isSmall to handle rendering based on size context.
src/main/webapp/app/shared/information-box/information-box.component.html Modified HTML structure and rendering logic for information box content.
src/main/webapp/app/shared/information-box/information-box.component.ts Updated InformationBox interface and added new interfaces for content types, enhancing type safety.
src/main/webapp/app/shared/layouts/navbar/navbar.component.html Added py-0 class to specific anchor elements for styling adjustments.
src/main/webapp/app/shared/layouts/navbar/navbar.scss Adjusted styling for breadcrumb component, including padding and font size.
src/main/webapp/app/shared/metis/metis.component.scss Modified styling for card components and responsive layout adjustments.
src/main/webapp/app/shared/sidebar/sidebar-card-item/sidebar-card-item.component.html Simplified conditional rendering logic for jhi-submission-result-status component.
src/main/webapp/app/shared/sidebar/sidebar.component.html Adjusted padding and margin for sidebar elements.
src/main/webapp/app/utils/date.utils.ts Introduced new utility function isDateLessThanAWeekInTheFuture.
src/main/webapp/content/scss/global.scss Modified sidebar styling, particularly the margin-right property.
src/main/webapp/content/scss/themes/_dark-variables.scss Adjusted sidebar dimensions and introduced a new spacing variable.
src/main/webapp/content/scss/themes/_default-variables.scss Updated sidebar dimensions and added a new spacing variable.
src/main/webapp/content/scss/themes/theme-default.scss Changed hover state color for button components.
src/main/webapp/i18n/de/programmingExercise.json Updated tooltip and title for submission policy section in German localization.
src/main/webapp/i18n/de/student-dashboard.json Removed colons from various key-value pairs in German localization for consistency.
src/main/webapp/i18n/en/programmingExercise.json Updated submission policy tooltip and title for clarity in English localization.
src/main/webapp/i18n/en/student-dashboard.json Removed colons from several key-value pairs in English localization for consistency.
src/test/javascript/spec/component/exercises/shared/headers/exercise-headers-information.component.spec.ts Introduced a test suite for ExerciseHeadersInformationComponent, validating its functionality and rendering logic.
src/test/javascript/spec/component/overview/exercise-details/course-exercise-details.component.spec.ts Added mock component for ExerciseHeadersInformationComponent in the test suite for CourseExerciseDetailsComponent.
src/test/javascript/spec/component/shared/difficulty-level.component.spec.ts Established a test suite for DifficultyLevelComponent, covering various scenarios for difficulty levels and tooltip display.
src/test/javascript/spec/component/shared/information-box.component.spec.ts Introduced a test suite for InformationBoxComponent, validating title and content display.
src/test/javascript/spec/util/date.utils.spec.ts Added tests for the new utility function isDateLessThanAWeekInTheFuture.
src/test/playwright/support/pageobjects/exercises/ExerciseResultPage.ts Modified locator in shouldShowScore method for score percentage visibility.
src/test/playwright/support/pageobjects/exercises/programming/ProgrammingExerciseOverviewPage.ts Updated locators for result score and exercise details methods to reflect changes in HTML structure.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Component
    participant Service

    User->>Component: Request exercise details
    Component->>Service: Fetch exercise data
    Service-->>Component: Return exercise data
    Component->>User: Display exercise details
Loading

Possibly related PRs

Suggested labels

feature, user interface, ready to merge

Suggested reviewers

  • Jan-Thurner
  • edkaya
  • SimonEntholzer
  • az108
  • pzdr7
  • krusche

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.

coderabbitai[bot]

This comment was marked as outdated.

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: 2

🧹 Outside diff range and nitpick comments (2)
src/test/javascript/spec/component/exercises/shared/headers/exercise-headers-information.component.spec.ts (2)

28-35: Improve type safety of mock exercise object

Consider using a proper type construction for the mock exercise object instead of type casting.

-    const exercise = {
-        id: 42,
-        type: ExerciseType.TEXT,
-        studentParticipations: [],
-        course: {},
-        dueDate: dayjs().subtract(1, 'weeks'),
-        assessmentDueDate: dayjs().add(1, 'weeks'),
-    } as unknown as Exercise;
+    const exercise: Exercise = {
+        id: 42,
+        type: ExerciseType.TEXT,
+        studentParticipations: [],
+        course: {} as Course,
+        dueDate: dayjs().subtract(1, 'weeks'),
+        assessmentDueDate: dayjs().add(1, 'weeks'),
+        maxPoints: 0,
+        bonusPoints: 0,
+        title: '',
+    };

58-81: Enhance information box items test assertions

The test could be more specific in validating the actual content of the information boxes rather than just checking their presence.

     const compiled = fixture.nativeElement as HTMLElement;
     const informationBoxes = compiled.querySelectorAll('jhi-information-box');
     expect(informationBoxes).toHaveLength(2);
+    const firstBox = informationBoxes[0];
+    expect(firstBox.getAttribute('ng-reflect-title')).toBe('Test Title 1');
+    expect(firstBox.getAttribute('ng-reflect-tooltip')).toBe('Test Tooltip 1');
+    expect(firstBox.getAttribute('ng-reflect-content-color')).toBe('primary');
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 747478d and 1aaa1c8.

📒 Files selected for processing (5)
  • src/main/webapp/app/exam/participate/exam-start-information/exam-start-information.component.ts (2 hunks)
  • src/main/webapp/app/overview/course-overview.component.scss (2 hunks)
  • src/main/webapp/app/overview/exercise-details/exercise-details-student-actions.component.html (2 hunks)
  • src/main/webapp/app/shared/exercise-categories/exercise-categories.component.html (1 hunks)
  • src/test/javascript/spec/component/exercises/shared/headers/exercise-headers-information.component.spec.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/main/webapp/app/exam/participate/exam-start-information/exam-start-information.component.ts
  • src/main/webapp/app/overview/course-overview.component.scss
  • src/main/webapp/app/overview/exercise-details/exercise-details-student-actions.component.html
  • src/main/webapp/app/shared/exercise-categories/exercise-categories.component.html
🧰 Additional context used
📓 Path-based instructions (1)
src/test/javascript/spec/component/exercises/shared/headers/exercise-headers-information.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

🔇 Additional comments (1)
src/test/javascript/spec/component/exercises/shared/headers/exercise-headers-information.component.spec.ts (1)

184-217: Split submission color tests for better maintainability

Copy link

@ahbitaqu ahbitaqu 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]
Works as described and expected, couldn't find any issues.
Apart from functionality tough, I think that the labels for the category, bonus, etc. are small and crowded, which might make them difficult to read.
image

Copy link

@JerroyTan JerroyTan 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 TS5]
I tested the boxes for Points, Submission Due, Start date, Status, Difficulty and Categories. Functionalities are all working as expected. Boxes also wrap on mobile view
Comment:

  • Difficulty box seems to be less obvious than the previous fully-colored background boxes
  • Box for Categories may be too small: it is very hard to read

Copy link

github-actions bot commented Nov 8, 2024

⚠️ Unable to deploy to test servers ⚠️

Testserver "artemis-test1.artemis.cit.tum.de" is already in use by PR #9629.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Nov 8, 2024
@github-actions github-actions bot removed the deployment-error Added by deployment workflows if an error occured label Nov 8, 2024
Copy link

github-actions bot commented Nov 9, 2024

⚠️ Unable to deploy to test servers ⚠️

Testserver "artemis-test1.artemis.cit.tum.de" is already in use by PR #9629.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Nov 9, 2024
@github-actions github-actions bot removed the deployment-error Added by deployment workflows if an error occured label Nov 9, 2024
@sawys777 sawys777 temporarily deployed to artemis-test3.artemis.cit.tum.de November 9, 2024 00:02 — with GitHub Actions Inactive
Copy link

@sawys777 sawys777 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 TS3, everything worked accordingly to the test description, however the tags in the categories box is a little too small.

@krusche krusche added this to the 7.7.0 milestone Nov 10, 2024
@krusche krusche merged commit e89f035 into develop Nov 10, 2024
145 of 155 checks passed
@krusche krusche deleted the chore/improve-exercise-details-page branch November 10, 2024 16:29
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!) playwright ready for review tests
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.