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

Development: Add client support for programming exercise feedback suggestions #7099

Merged
merged 74 commits into from
Oct 4, 2023

Conversation

pal03377
Copy link
Contributor

@pal03377 pal03377 commented Aug 26, 2023

Note
The hardcoded example feedback suggestions will need to be removed before merging.

Quick links:

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

See #7094. We want to implement programming feedback suggestions on the client. Also, this PR refactors some parts of the code editor assessment area, making it more robust.

Description

Steps for Testing

Prerequisites:

  • 1 TA
  • 1 Programming Exercise with manual assessment enabled and with submissions to assess. The package name has to be de.athena and include BubbleSort.java because otherwise, the hardcoded example feedback suggestion will point nowhere!
  1. Log in to Artemis
  2. Go into the exercise dashboard and start the assessment
  3. Play around with the feedback in the editor:
  • Create lots of inline feedback
  • Create general feedback
  • Switch between files rapidly
  • Save, Cancel, Delete feedback
  • Rename files
  • Collapse folders
  1. Test referenced feedback suggestions: You will see hardcoded referenced feedback suggestions in BubbleSort.java and MergeSort.java. Accept or discard them. You can get it back by not saving the whole assessment and refreshing the page. It is expected that discarded feedback re-appears this way. Try editing it as well. Check that the feedback suggestion badge always appropriately represents the state of the suggestion. Also, switch around in files again.
  2. Test unreferenced feedback suggestions the same way. There is one unreferenced feedback suggestion at the bottom.
  3. Save the assessment. Refresh and inspect the feedback on the page. Edit it again.
  4. Look at the feedback from the perspective of a student.
  5. Check that the feedback suggestions don't influence the overall score until they are accepted.
  6. Collapse the src/de/athena folder. The feedback suggestions badge should sum up the badges of all files and show up next to the collapsed folder.

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)
assessment-detail.component.ts not found (deleted)
athena.service.ts Currently incorrect because of testing data, should be close to 100%
assessment-correction-round-badge.component.ts not found (renamed)
unreferenced-feedback-detail.component.ts 100%
feedback.model.ts 96.69%
code-editor-tutor-assessment-container.component.ts 86.19% ✅ up from ~85%
code-editor-tutor-assessment-inline-feedback-suggestion.component.ts 100%
code-editor-tutor-assessment-inline-feedback.component.ts 98.11%
code-editor-ace.component.ts 84.27% ✅ up from ~81%
code-editor-container.component.ts 86.36% ✅ up from ~85%
code-editor-file-browser-badge.component.ts 100%
code-editor-file-browser-file.component.ts 100%
code-editor-file-browser.component.ts 86.03% ✅ up from ~85%
code-editor.model.ts 100%
feedback-suggestion-badge.component.ts 100%
unreferenced-feedback.component.ts 96.55%
textblock-feedback-editor.component.ts 92.98%

Screenshots

screenshot-2023-08-28_001852
screenshot-2023-08-28_001853
screenshot-2023-08-28_001854
screenshot-2023-08-28_001855
screenshot-2023-08-28_001856
screenshot-2023-08-28_001858

Student view: No feedback suggestion badges:

screenshot-2023-08-28_001859

@pal03377 pal03377 self-assigned this Aug 26, 2023
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Aug 26, 2023
@github-actions github-actions bot added the cypress Pull requests that update cypress tests. (Added Automatically!) label Aug 28, 2023
@pal03377 pal03377 changed the title Programming Exercises: Add support for Athena feedback suggestions Programming Exercises: Add client-side support for feedback suggestions Aug 28, 2023
Copy link
Contributor Author

@pal03377 pal03377 left a comment

Choose a reason for hiding this comment

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

I added a few notes for code reviewers to make it easier to understand changes.

@@ -1,71 +0,0 @@
<div (drop)="updateAssessmentOnDrop($event)" (dragover)="$event.preventDefault()" class="card mb-3" id="assessment-detail">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for code reviewers: I renamed this component to unreferenced-feedback-detail, as that's what it really is.

@@ -25,21 +26,22 @@ const ENTITY_STATES = [...assessmentLocksRoute];
RouterModule.forChild(ENTITY_STATES),
ArtemisMarkdownModule,
ArtemisGradingInstructionLinkIconModule,
ArtemisFeedbackModule,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for code reviewers: This is needed to get the new feedback-suggestion-badge component.

Comment on lines 23 to 40
// For debugging: Return basic feedback suggestions for BubbleSort.java
const referencedFeedbackSuggestion = new Feedback();
referencedFeedbackSuggestion.id = 1;
referencedFeedbackSuggestion.credits = 1;
referencedFeedbackSuggestion.text = 'FeedbackSuggestion:';
referencedFeedbackSuggestion.detailText = 'This is a referenced feedback suggestion - test test';
referencedFeedbackSuggestion.gradingInstruction = undefined;
referencedFeedbackSuggestion.reference = 'file:src/de/athena/BubbleSort.java_line:14';
referencedFeedbackSuggestion.type = FeedbackType.AUTOMATIC;
const unreferencedFeedbackSuggestion = new Feedback();
unreferencedFeedbackSuggestion.id = 2;
unreferencedFeedbackSuggestion.credits = -1;
unreferencedFeedbackSuggestion.text = 'FeedbackSuggestion:';
unreferencedFeedbackSuggestion.detailText = 'This is an unreferenced feedback suggestion';
unreferencedFeedbackSuggestion.gradingInstruction = undefined;
unreferencedFeedbackSuggestion.reference = undefined;
unreferencedFeedbackSuggestion.type = FeedbackType.AUTOMATIC;
return of([referencedFeedbackSuggestion, unreferencedFeedbackSuggestion]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This must and will be removed before the PR is merged. It's nice for testing, though.

Comment on lines 1 to 17
<div (drop)="updateFeedbackOnDrop($event)" (dragover)="$event.preventDefault()" class="card mb-3" [class.is-suggestion]="isSuggestion" id="assessment-detail">
<div class="card-header">
<jhi-feedback-suggestion-badge *ngIf="isSuggestion || Feedback.isFeedbackSuggestion(feedback)" [feedback]="feedback"></jhi-feedback-suggestion-badge>
<jhi-grading-instruction-link-icon *ngIf="feedback.gradingInstruction" [feedback]="feedback"></jhi-grading-instruction-link-icon>
<fa-icon [icon]="faTrashAlt" class="float-end" (click)="delete()" *ngIf="!readOnly"></fa-icon>
<!-- Accept/Discard for feedback suggestions -->
<div class="row float-end suggestion-action-buttons" *ngIf="isSuggestion">
<button class="btn btn-success m-1" (click)="onAcceptSuggestion.emit(feedback)">
<fa-icon [icon]="faCheck"></fa-icon>
<span jhiTranslate="artemisApp.assessment.detail.accept">Accept</span>
</button>
<button class="btn btn-danger m-1" (click)="onDiscardSuggestion.emit(feedback)">
<fa-icon [icon]="faTrash"></fa-icon>
<span jhiTranslate="artemisApp.assessment.detail.discard">Discard</span>
</button>
</div>
</div>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for code reviewers: The card-header and the is-suggestion class are the only new parts apart from the rename of the component from assessment-detail to unreferenced-feedback-detail

Comment on lines -91 to +98
return !feedback.text.includes(STATIC_CODE_ANALYSIS_FEEDBACK_IDENTIFIER, 0) && !feedback.text.includes(SUBMISSION_POLICY_FEEDBACK_IDENTIFIER, 0);
return !feedback.text.startsWith(STATIC_CODE_ANALYSIS_FEEDBACK_IDENTIFIER) && !feedback.text.startsWith(SUBMISSION_POLICY_FEEDBACK_IDENTIFIER);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for code reviewers: This is just a nicer way to write it

@@ -202,10 +236,6 @@ export class CodeEditorContainerComponent implements ComponentCanDeactivate {
this.onFileChanged.emit();
}

updateFeedback(feedbacks: Feedback[]) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for code reviewers: We now call onUpdateFeedback.emit directly

@@ -0,0 +1,4 @@
<span class="badge" [class.on-colored-background]="onColoredBackground" [ngbTooltip]="tooltip">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for code reviewers: That's the badge on the right:
screenshot-2023-08-28_001851

<!-- File level actions -->
<span class="file-icons" [ngClass]="item.checked ? 'text-white' : 'primary'">
<button [disabled]="disableActions" (click)="setRenamingNode($event)" class="btn btn-small">
<span class="file-icons" [ngClass]="item.checked ? 'text-white' : 'primary'" *ngIf="!disableActions">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for code reviewers: We now hide the file actions completely if they are not available: A tutor doesn't need to see a rename button they can't press anyway.

@@ -3,25 +3,31 @@
<button id="add-unreferenced-feedback" class="btn btn-success mt-4" (click)="addUnreferencedFeedback()" [disabled]="readOnly">
{{ 'artemisApp.fileUploadAssessment.addFeedback' | artemisTranslate }}
</button>
<ng-container *ngIf="!busy">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for code reviewers: The busy property was never set to true, so I removed this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only the part with <div *ngFor="let suggestion of feedbackSuggestions" class="col-12 col-lg-6 col-xl-6"> (line 22+) is new.

faExclamation = faExclamation;
faBalanceScaleRight = faBalanceScaleRight;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for code reviewers: This was just unused

Copy link
Member

@bassner bassner left a comment

Choose a reason for hiding this comment

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

Hey, did a quick code review. Retesting should not be necessary for these changes

@github-actions

This comment was marked as outdated.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Sep 28, 2023
@pal03377 pal03377 requested a review from bassner September 28, 2023 21:34
@pal03377 pal03377 removed the deployment-error Added by deployment workflows if an error occured label Sep 28, 2023
@krusche krusche modified the milestones: 6.5.4, 6.6.0 Oct 3, 2023
@krusche krusche merged commit 14cf78c into develop Oct 4, 2023
15 of 18 checks passed
@krusche krusche deleted the feature/programming-exercises/feedback-suggestions branch October 4, 2023 16:08
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!) component:Programming cypress Pull requests that update cypress tests. (Added Automatically!) feature maintainer-approved The feature maintainer has approved the PR ready for review ready to merge tests
Projects
None yet