-
Notifications
You must be signed in to change notification settings - Fork 289
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
Text exercises
: Replace feedback modal with inline feedback view
#9395
base: develop
Are you sure you want to change the base?
Text exercises
: Replace feedback modal with inline feedback view
#9395
Conversation
…, add text blocks
There was a problem hiding this 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 (3)
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts (2)
32-34
: Add documentation for input properties.Consider adding JSDoc comments to document the purpose and usage of these input properties. This will improve code maintainability and help other developers understand how to use this component correctly.
+ /** Indicates whether the exercise has been submitted */ isSubmitted = input<boolean>(); + /** Indicates whether there are unsaved changes in the exercise */ pendingChanges = input<boolean>(false); + /** Indicates whether the latest submission has an Athena result */ hasAthenaResultForLatestSubmission = input<boolean>(false);
Line range hint
91-101
: Update method documentation to reflect current implementation.The current documentation doesn't reflect all conditions and exercise types handled by the method. Update it to include MODELING type and text-specific conditions.
/** * Checks if the conditions for requesting automatic non-graded feedback are satisfied. * The student can request automatic non-graded feedback under the following conditions: + * For PROGRAMMING and MODELING exercises: * 1. They have a graded submission. * 2. The deadline for the exercise has not been exceeded. * 3. There is no already pending feedback request. + * For TEXT exercises: + * 1. No Athena result exists for the latest submission + * 2. There are no pending changes * @returns {boolean} `true` if all conditions are satisfied, otherwise `false`. */src/test/javascript/spec/component/overview/exercise-details/request-feedback-button/request-feedback-button.component.spec.ts (1)
Line range hint
1-238
: Enhance test specificity and mocking practices.While the test suite is well-structured, consider these improvements to align better with the coding guidelines:
Use more specific assertions:
- Replace
toBeTrue()/toBeFalse()
withtoBe(true)/toBe(false)
for boolean assertions- Add component state checks alongside DOM checks
- Use
toHaveBeenCalledExactlyOnceWith
instead oftoHaveBeenCalled
Mock improvements:
- Use
MockProvider
consistently for all services- Mock irrelevant dependencies more aggressively
- Consider using
jest.mocked()
for better type safetyError handling:
- Add test cases for different error scenarios
- Verify error message content more specifically
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (5)
- src/main/webapp/app/exercises/text/participate/text-editor.component.html (4 hunks)
- src/main/webapp/app/overview/exercise-details/exercise-details-student-actions.component.html (1 hunks)
- src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.html (1 hunks)
- src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts (2 hunks)
- src/test/javascript/spec/component/overview/exercise-details/request-feedback-button/request-feedback-button.component.spec.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/webapp/app/exercises/text/participate/text-editor.component.html
- src/main/webapp/app/overview/exercise-details/exercise-details-student-actions.component.html
🧰 Additional context used
📓 Path-based instructions (3)
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.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/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts (1)
src/test/javascript/spec/component/overview/exercise-details/request-feedback-button/request-feedback-button.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 (3)
src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.html (2)
Line range hint
1-3
: LGTM: Proper usage of new Angular control flow syntax.The template correctly uses the new
@if
syntax instead of the older*ngIf
directives, following the latest Angular best practices and project coding guidelines.
8-8
: LGTM: Clean refactoring of disabled state condition.The simplified condition
!isSubmitted()
improves readability by moving the complex logic to the component class. This change makes the template more maintainable and easier to understand.src/main/webapp/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts (1)
113-116
:⚠️ Potential issueFix input property access.
The
hasAthenaResultForLatestSubmission
is an input property but is being called as a method. This needs to be fixed to access the property value correctly.- if (this.hasAthenaResultForLatestSubmission()) { + if (this.hasAthenaResultForLatestSubmission()) {Likely invalid or redundant comment.
...p/app/overview/exercise-details/request-feedback-button/request-feedback-button.component.ts
Show resolved
Hide resolved
.../overview/exercise-details/request-feedback-button/request-feedback-button.component.spec.ts
Show resolved
Hide resolved
|
There was a problem hiding this 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
🧹 Outside diff range and nitpick comments (2)
src/test/javascript/spec/component/overview/exercise-details/request-feedback-button/request-feedback-button.component.spec.ts (2)
218-219
: Enhance test specificity with additional assertions.While the test correctly verifies the button state, consider adding assertions to explicitly verify that both conditions influence the button's enabled state:
expect(component.isSubmitted).toBeTrue(); expect(component.isGeneratingFeedback).toBeFalse();This makes it clearer which conditions are being tested and helps with debugging if the test fails.
Line range hint
1-230
: Add test coverage for missing scenarios.The test suite is missing coverage for:
- The
pendingChanges
input property's effect on the button state- The case when
isGeneratingFeedback
is true butisSubmitted
is also trueConsider adding these test cases:
it('should disable the button when there are pending changes', fakeAsync(() => { setAthenaEnabled(true); const participation = { id: 1, submissions: [{ id: 1, submitted: true }], testRun: false, } as StudentParticipation; const exercise = { id: 1, type: ExerciseType.TEXT, studentParticipations: [participation], course: {}, allowFeedbackRequests: true } as Exercise; fixture.componentRef.setInput('exercise', exercise); fixture.componentRef.setInput('isSubmitted', true); fixture.componentRef.setInput('isGeneratingFeedback', false); fixture.componentRef.setInput('pendingChanges', true); mockExerciseDetails(exercise); component.ngOnInit(); tick(); fixture.detectChanges(); const button = debugElement.query(By.css('button')); expect(button.nativeElement.disabled).toBeTrue(); expect(component.pendingChanges).toBeTrue(); })); it('should disable the button when feedback is being generated regardless of submission state', fakeAsync(() => { setAthenaEnabled(true); const participation = { id: 1, submissions: [{ id: 1, submitted: true }], testRun: false, } as StudentParticipation; const exercise = { id: 1, type: ExerciseType.TEXT, studentParticipations: [participation], course: {}, allowFeedbackRequests: true } as Exercise; fixture.componentRef.setInput('exercise', exercise); fixture.componentRef.setInput('isSubmitted', true); fixture.componentRef.setInput('isGeneratingFeedback', true); mockExerciseDetails(exercise); component.ngOnInit(); tick(); fixture.detectChanges(); const button = debugElement.query(By.css('button')); expect(button.nativeElement.disabled).toBeTrue(); expect(component.isGeneratingFeedback).toBeTrue(); }));
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
- src/test/javascript/spec/component/overview/exercise-details/request-feedback-button/request-feedback-button.component.spec.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/test/javascript/spec/component/overview/exercise-details/request-feedback-button/request-feedback-button.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/overview/exercise-details/request-feedback-button/request-feedback-button.component.spec.ts (1)
196-197
: Past review comment is still applicable.The existing review comment about splitting this test case into multiple test cases for better coverage is still valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on TS1, still works fine. Re-approve
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on TS1. Re-approved 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code- latest changes look good to me
Reopened from: #9310
Checklist
General
- [ ] This is a small issue that I tested locally and was confirmed by another developer on a test server.Server
- [ ] I strictly followed the principle of data economy for all database calls.- [ ] I added pre-authorization annotations according to the [guidelines](https://docs.artemis.cit.tum.de/dev/guidelines/server/#rest-endpoint-best-practices-for-authorization) and checked the course groups for all new REST Calls (security).Client
authorities
to all new routes and checked the course groups for displaying navigation elements (links, buttons).Motivation and Context
The previous PR in Athena Feedback for Text Exercises added the option to enable preliminary AI Feedback for students. This PR improves the way the feedback is viewed by adding a new route. Enhanced error handling, integration tests and some minor bug fixes are also included.
Description
Create new route to view the (preliminary) results inline on the text submission. Add the timeline to that view and make results not show the modal but use that route for text exercises.
Steps for Testing
Prerequisites:
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
Code Review
Manual Tests
Test Coverage
✅ ❌
Screenshots
Flow
H01E01.Coupling.and.Cohesion.WS24._.Test.Course.Enea.Gore.-.Google.Chrome.2024-09-14.06-37-35.mp4
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Documentation
Chores