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

Modeling exercises: Enhance modeling feedback layout #10238

Merged
merged 27 commits into from
Feb 2, 2025

Conversation

LeonWehrhahn
Copy link
Contributor

@LeonWehrhahn LeonWehrhahn commented Jan 31, 2025

Checklist

General

Client

  • 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 screenshots/screencasts of my UI changes.

Motivation and Context

This PR streamlines the modeling feedback view for better usability. Previously, long feedback could overlap the editor, and the submission history lacked a clear indication of the current selection. Additionally, the submission history items were not sorted correctly. This revision resolves feedback overlap, visually highlights the active submission in the history, corrects the submission history sorting, and removes the displayed complaint inputs for AI feedback.

Description

  • Feedback View Optimization: Collapses problem statement in feedback view to prioritize editor and assessment areas.
  • Responsive Column Layout: Adjusts editor/assessment column widths for improved screen utilization.
  • Scrollable Assessment Area: Adds overflow for long feedback lists, preventing layout issues.
  • Enables Result History Highlighting: Passes selectedResultId to jhi-result-history, to highlight the current selected submission.
  • Fixes Submission History Sorting: Updates the sorting logic in modeling-submission.component.ts to correctly order submission history items by submission time.

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Students
  • 1 Course with access to restricted Athena models
  • 1 Modeling exercises with Athena feedback suggestions enabled
  1. Log in as a student and participate in a modeling exercise. Submit a solution and request AI feedback. Submit multiple solutions over time.
  2. Verify the layout in feedback view:
    • Confirm that the problem statement area in the jhi-resizeable-container is collapsed by default.
    • Check that the editor and assessment sections are well-proportioned and utilize screen space effectively, especially on wider screens.
    • Ensure that if there is a lot of feedback in the assessment section, the area is scrollable using overflow-auto and doesn't break the layout.
  3. Verify Submission History Highlighting:
    • In the feedback inline view, locate the submission history component.
    • Check that the currently displayed submission in the history is visually highlighted (blue circle outline).
    • If there are multiple submissions in the history, navigate between them and confirm that the highlighting correctly updates to reflect the currently viewed submission.
  4. Verify Submission History Sorting:
    • In the feedback inline view, locate the submission history component.
    • Check that the submissions are now correctly sorted by submission time, with the latest submission appearing last.

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

Performance Tests

  • Test 1
  • Test 2

Screenshots

Submission History Highlighting: This screenshot demonstrates the visual highlighting of the currently selected submission within the result history timeline.

image

Responsive Layout for Wide Models: This screenshot showcases the improved layout when viewing ultra-wide UML models. The editor and assessment areas are now proportionally adjusted, ensuring the model and feedback are viewable at the same time.

image

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced modeling submission component with improved result history display.
    • Added new input properties for result and container components.
  • Style

    • Introduced .editor-assessment CSS class for better layout control.
    • Adjusted component layout and rendering conditions.
  • Bug Fixes

    • Updated sorting logic for submission history to reflect accurate order based on completion dates.

The changes improve the user interface and feedback display for modeling exercise submissions.

@LeonWehrhahn LeonWehrhahn requested a review from a team as a code owner January 31, 2025 14:44
@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Jan 31, 2025
Copy link

coderabbitai bot commented Jan 31, 2025

Walkthrough

The pull request introduces modifications to the modeling submission component across HTML, SCSS, and TypeScript files. Key updates include the addition of new input properties to components like <jhi-result-history> and <jhi-resizeable-container>, the introduction of a new CSS class for layout management, and changes to the sorting logic for submission history using dayjs for date comparisons. The structure of the submission container has been reorganized, and conditional rendering for feedback components has been refined.

Changes

File Change Summary
src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.html - Added [selectedResultId] to <jhi-result-history>
- Added [collapsed] to <jhi-resizeable-container>
- Restructured submission container layout
- Refined conditional rendering for feedback components
src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.scss - Added new .editor-assessment CSS class with max-width: 70vw and height: 100vh
src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.ts - Updated sorting logic for submission history using dayjs
- Modified sorting order for submission history to ascending
- Updated logic for retrieving unreferenced feedback
src/test/javascript/spec/component/modeling-submission/modeling-submission.component.spec.ts - Updated expected sorted submissions and results in tests to reflect new sorting logic

Possibly related PRs

Suggested labels

enhancement, ready to merge, assessment, modeling

Suggested reviewers

  • EneaGore
  • BBesrour
  • HawKhiem
  • SimonEntholzer
  • krusche
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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. (Beta)
  • @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

@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: 0

🧹 Nitpick comments (2)
src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.scss (1)

17-20: Consider adding responsive breakpoints for better mobile support.

The fixed max-width: 70vw might cause content overflow on smaller screens. Consider adding media queries to adjust the width based on screen size.

 .editor-assessment {
     max-width: 70vw;
     max-height: 100vh;
+    @media (max-width: 768px) {
+        max-width: 90vw;
+    }
+    @media (max-width: 480px) {
+        max-width: 100vw;
+    }
 }
src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.html (1)

Line range hint 1-204: Consider standardizing string literal quotes.

For better consistency, consider standardizing the use of quotes throughout the template. Currently, there's a mix of single quotes (e.g., 'col-12 editor-large') and double quotes.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f7c5970 and f2f4176.

📒 Files selected for processing (5)
  • src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.html (3 hunks)
  • src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.scss (1 hunks)
  • src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.ts (3 hunks)
  • src/main/webapp/app/exercises/shared/result/result.utils.ts (1 hunks)
  • src/test/javascript/spec/component/utils/result.utils.spec.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/test/javascript/spec/component/utils/result.utils.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}}

src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.html (1)

Pattern src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

src/main/webapp/app/exercises/shared/result/result.utils.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Call Build Workflow / Build and Push Docker Image
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: server-tests
  • GitHub Check: Analyse
🔇 Additional comments (7)
src/test/javascript/spec/component/utils/result.utils.spec.ts (1)

4-4: LGTM! Test coverage for the new feedback filtering function looks good.

The test case properly verifies that getAutomaticUnreferencedFeedback correctly filters out non-automatic feedback and referenced feedback.

Also applies to: 34-43

src/main/webapp/app/exercises/shared/result/result.utils.ts (1)

128-134: LGTM! Clean implementation of the automatic feedback filter.

The function correctly filters for unreferenced feedback of type AUTOMATIC with clear documentation.

src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.ts (1)

18-18: LGTM! Consistent update to use the new feedback filtering function.

The getter method correctly uses getAutomaticUnreferencedFeedback while maintaining the existing assessment result checks.

Also applies to: 699-699

src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.html (4)

58-58: LGTM! Enhanced result history visibility.

The addition of [selectedResultId] binding improves the user experience by highlighting the current selection in the submission history, which aligns with the PR objectives.


64-64: LGTM! Improved layout control.

The addition of [collapsed] binding implements the requirement to collapse the problem statement by default in feedback view, optimizing screen space for editor and assessment areas.


Line range hint 68-188: LGTM! Enhanced layout structure and responsiveness.

The new container structure implements several key improvements:

  • Responsive layout using flex classes
  • Proper overflow handling for long feedback lists
  • Clear separation of editor and assessment columns

These changes align with the PR objectives for improving screen utilization and preventing layout issues.


199-204: LGTM! Updated Angular syntax.

The conditional rendering blocks correctly use the new @if syntax as per coding guidelines, replacing the older *ngIf syntax.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 31, 2025
@github-actions github-actions bot removed the tests label Jan 31, 2025
@LeonWehrhahn LeonWehrhahn changed the title Feature/modeling/inline view Modeling: Enhance Modeling Feedback Layout Jan 31, 2025
@LeonWehrhahn LeonWehrhahn changed the title Modeling: Enhance Modeling Feedback Layout Modeling: Enhance Modeling Feedback Layout Jan 31, 2025
@LeonWehrhahn LeonWehrhahn changed the title Modeling: Enhance Modeling Feedback Layout Modeling exercises : Enhance Modeling Feedback Layout Jan 31, 2025
@LeonWehrhahn LeonWehrhahn changed the title Modeling exercises : Enhance Modeling Feedback Layout Modeling exercises: Enhance Modeling Feedback Layout Jan 31, 2025
@LeonWehrhahn LeonWehrhahn temporarily deployed to artemis-test1.artemis.cit.tum.de January 31, 2025 15:10 — with GitHub Actions Inactive
Copy link

github-actions bot commented Feb 1, 2025

⚠️ Unable to deploy to test servers ⚠️

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

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Feb 1, 2025
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: 0

🧹 Nitpick comments (2)
src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.ts (2)

246-270: Optimize submission history sorting logic.

The current implementation can be improved for better maintainability and code reuse.

Consider applying these improvements:

 private fetchSubmissionHistory() {
     return this.modelingSubmissionService.getSubmissionsWithResultsForParticipation(this.participationId!).pipe(
         catchError((error: HttpErrorResponse) => {
             onError(this.alertService, error);
             return of([]);
         }),
         tap((submissions: ModelingSubmission[]) => {
             this.sortedSubmissionHistory = submissions.sort((a, b) => {
-                const latestResultA = this.sortResultsByCompletionDate(a.results ?? [])[0];
-                const latestResultB = this.sortResultsByCompletionDate(b.results ?? [])[0];
-                const dateA = latestResultA?.completionDate ? dayjs(latestResultA.completionDate).valueOf() : 0;
-                const dateB = latestResultB?.completionDate ? dayjs(latestResultB.completionDate).valueOf() : 0;
-                return dateA - dateB;
+                const getLatestCompletionDate = (submission: ModelingSubmission) => {
+                    const latestResult = this.sortResultsByCompletionDate(submission.results ?? [])[0];
+                    return latestResult?.completionDate ? dayjs(latestResult.completionDate).valueOf() : 0;
+                };
+                return getLatestCompletionDate(a) - getLatestCompletionDate(b);
             });

             this.sortedResultHistory = this.sortedSubmissionHistory
                 .map((submission) => {
-                    let latestResult: Result | undefined;
-                    if (submission?.results && submission.results.length > 0) {
-                        const sortedResults = [...submission.results].sort((a, b) => {
-                            const dateA = a.completionDate ? dayjs(a.completionDate).valueOf() : 0;
-                            const dateB = b.completionDate ? dayjs(b.completionDate).valueOf() : 0;
-                            return dateB - dateA;
-                        });
-                        latestResult = sortedResults[0];
-                    }
+                    const latestResult = submission?.results?.length ? 
+                        this.sortResultsByCompletionDate(submission.results)[0] : undefined;

                     if (latestResult) {
                         latestResult.participation = submission.participation;
                     }
                     return latestResult;
                 })
                 .filter((result): result is Result => !!result);
         }),
     );
 }

426-427: Simplify condition using optional chaining.

The condition check can be made more concise using optional chaining.

Apply this improvement:

-                const latestResult = getLatestSubmissionResult(this.submission);
-                if (latestResult && latestResult.completionDate && (this.isAfterAssessmentDueDate || latestResult.assessmentType === AssessmentType.AUTOMATIC_ATHENA)) {
+                if (getLatestSubmissionResult(this.submission)?.completionDate && 
+                    (this.isAfterAssessmentDueDate || getLatestSubmissionResult(this.submission)?.assessmentType === AssessmentType.AUTOMATIC_ATHENA)) {
🧰 Tools
🪛 Biome (1.9.4)

[error] 427-427: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 53ebc9f and d55c6bf.

📒 Files selected for processing (2)
  • src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.scss (1 hunks)
  • src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.scss
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

🪛 Biome (1.9.4)
src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.ts

[error] 427-427: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: server-tests-mysql
🔇 Additional comments (2)
src/main/webapp/app/exercises/modeling/participate/modeling-submission.component.ts (2)

59-59: LGTM!

The import statement is correctly placed with other component imports.


277-279: LGTM!

The date comparison logic using dayjs is correct and follows best practices.

@LeonWehrhahn LeonWehrhahn added deploy:artemis-test3 and removed deployment-error Added by deployment workflows if an error occured labels Feb 1, 2025
@LeonWehrhahn LeonWehrhahn temporarily deployed to artemis-test3.artemis.cit.tum.de February 1, 2025 18:03 — with GitHub Actions Inactive
Copy link
Member

@maximiliansoelch maximiliansoelch 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 TS1 & TS3, works as described and expected 👍

@krusche krusche modified the milestones: 7.9.1, 7.9.2 Feb 2, 2025
Copy link
Contributor

@ahmetsenturk ahmetsenturk 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, works as described 👍

Copy link

@ItsaaaMeMario ItsaaaMeMario 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 works as expected.

Bildschirmfoto 2025-02-02 um 21 54 27

@maximiliansoelch maximiliansoelch added ready to merge maintainer-approved The feature maintainer has approved the PR and removed ready for review labels Feb 2, 2025
@krusche krusche changed the title Modeling exercises: Enhance Modeling Feedback Layout Modeling exercises: Enhance modeling feedback layout Feb 2, 2025
@krusche krusche modified the milestones: 7.9.2, 7.9.1 Feb 2, 2025
@krusche krusche merged commit 99e61e1 into develop Feb 2, 2025
44 of 48 checks passed
@krusche krusche deleted the feature/modeling/inline-view branch February 2, 2025 21:22
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!) maintainer-approved The feature maintainer has approved the PR ready to merge tests
Projects
Status: Merged
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants