Skip to content

Commit

Permalink
Modeling exercises: Fix manual feedback results not being shown (#10132)
Browse files Browse the repository at this point in the history
  • Loading branch information
muradium authored Jan 12, 2025
1 parent fda9e65 commit 0646b25
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ModelingAssessmentService } from 'app/exercises/modeling/assess/modelin
import { ModelingSubmissionService } from 'app/exercises/modeling/participate/modeling-submission.service';
import { ModelingEditorComponent } from 'app/exercises/modeling/shared/modeling-editor.component';
import { getExerciseDueDate, hasExerciseDueDatePassed } from 'app/exercises/shared/exercise/exercise.utils';
import { addParticipationToResult, getAutomaticUnreferencedFeedback } from 'app/exercises/shared/result/result.utils';
import { addParticipationToResult, getUnreferencedFeedback } from 'app/exercises/shared/result/result.utils';
import { AccountService } from 'app/core/auth/account.service';
import { GuidedTourService } from 'app/guided-tour/guided-tour.service';
import { modelingTour } from 'app/guided-tour/tours/modeling-tour';
Expand Down Expand Up @@ -664,7 +664,7 @@ export class ModelingSubmissionComponent implements OnInit, OnDestroy, Component
get unreferencedFeedback(): Feedback[] | undefined {
if (this.assessmentResult?.feedbacks) {
checkSubsequentFeedbackInAssessment(this.assessmentResult.feedbacks);
return getAutomaticUnreferencedFeedback(this.assessmentResult.feedbacks);
return getUnreferencedFeedback(this.assessmentResult.feedbacks);
}
return undefined;
}
Expand Down
10 changes: 7 additions & 3 deletions src/main/webapp/app/exercises/shared/result/result.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,16 @@ export const getManualUnreferencedFeedback = (feedbacks: Feedback[] | undefined)
};

/**
* searches for all automatic unreferenced feedback in an array of feedbacks of a result
* searches for all unreferenced feedback in an array of feedbacks of a result
* @param feedbacks the feedback of a result
* @returns an array with the unreferenced feedback of the result
*/
export const getAutomaticUnreferencedFeedback = (feedbacks: Feedback[] | undefined): Feedback[] | undefined => {
return feedbacks ? feedbacks.filter((feedbackElement) => !feedbackElement.reference && feedbackElement.type === FeedbackType.AUTOMATIC) : undefined;
export const getUnreferencedFeedback = (feedbacks: Feedback[] | undefined): Feedback[] | undefined => {
return feedbacks
? feedbacks.filter(
(feedbackElement) => !feedbackElement.reference && (feedbackElement.type === FeedbackType.MANUAL_UNREFERENCED || feedbackElement.type === FeedbackType.AUTOMATIC),
)
: undefined;
};

export function isAIResultAndFailed(result: Result | undefined): boolean {
Expand Down
8 changes: 4 additions & 4 deletions src/test/javascript/spec/component/utils/result.utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
ResultTemplateStatus,
breakCircularResultBackReferences,
getAutomaticUnreferencedFeedback,
getManualUnreferencedFeedback,
getResultIconClass,
getTextColorClass,
getUnreferencedFeedback,
isOnlyCompilationTested,
} from 'app/exercises/shared/result/result.utils';
import { Feedback, FeedbackType, STATIC_CODE_ANALYSIS_FEEDBACK_IDENTIFIER } from 'app/entities/feedback.model';
Expand All @@ -31,16 +31,16 @@ describe('ResultUtils', () => {
expect(unreferencedFeedbacks).toEqual([{ type: FeedbackType.MANUAL_UNREFERENCED }]);
});

it('should filter out all non unreferenced feedbacks that do not have type AUTOMATIC', () => {
it('should filter out all non unreferenced feedbacks', () => {
const feedbacks = [
{ reference: 'foo' },
{ reference: 'foo', type: FeedbackType.AUTOMATIC },
{ type: FeedbackType.AUTOMATIC },
{ type: FeedbackType.MANUAL_UNREFERENCED },
{},
];
const unreferencedFeedbacks = getAutomaticUnreferencedFeedback(feedbacks);
expect(unreferencedFeedbacks).toEqual([{ type: FeedbackType.AUTOMATIC }]);
const unreferencedFeedbacks = getUnreferencedFeedback(feedbacks);
expect(unreferencedFeedbacks).toEqual([{ type: FeedbackType.AUTOMATIC }, { type: FeedbackType.MANUAL_UNREFERENCED }]);
});

it.each([
Expand Down

0 comments on commit 0646b25

Please sign in to comment.