Skip to content

Commit

Permalink
Modeling exercises: Fix submission error and redundant tooltip for AI…
Browse files Browse the repository at this point in the history
… feedback (#9437)
  • Loading branch information
LeonWehrhahn authored Oct 12, 2024
1 parent db90e89 commit d8c99a2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,14 @@ SELECT COUNT(DISTINCT p)
*/
boolean existsByParticipationId(long participationId);

/**
* Checks if a result exists for the given submission ID.
*
* @param submissionId the ID of the submission to check.
* @return true if a result exists for the given submission ID, false otherwise.
*/
boolean existsBySubmissionId(long submissionId);

/**
* Returns true if there is at least one result for the given exercise.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,10 @@ public ModelingSubmission handleModelingSubmission(ModelingSubmission modelingSu
}

// if athena results are present, then create a new submission on submit
if (modelingSubmission.getParticipation() != null && modelingSubmission.getParticipation().getResults() != null
&& !modelingSubmission.getParticipation().getResults().isEmpty()) {
log.debug("Creating a new submission due to Athena results for user: {}", user.getLogin());
// If results exist for this submission, create a new submission by setting the ID to null
if (modelingSubmission.getId() != null && resultRepository.existsBySubmissionId(modelingSubmission.getId())) {
modelingSubmission.setId(null);
}

modelingSubmission = save(modelingSubmission, exercise, user, participation);
return modelingSubmission;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ public ResponseEntity<ModelingSubmission> createModelingSubmission(@PathVariable
@PutMapping("exercises/{exerciseId}/modeling-submissions")
@EnforceAtLeastStudent
public ResponseEntity<ModelingSubmission> updateModelingSubmission(@PathVariable long exerciseId, @Valid @RequestBody ModelingSubmission modelingSubmission) {
log.debug("REST request to update modeling submission: {}", modelingSubmission.getModel());
if (modelingSubmission.getId() == null) {
return createModelingSubmission(exerciseId, modelingSubmission);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { faExclamationTriangle, faGripLines } from '@fortawesome/free-solid-svg-
import { faListAlt } from '@fortawesome/free-regular-svg-icons';
import { onError } from 'app/shared/util/global.utils';
import { SubmissionPatch } from 'app/entities/submission-patch.model';
import { AssessmentType } from 'app/entities/assessment-type.model';

@Component({
selector: 'jhi-modeling-submission',
Expand Down Expand Up @@ -296,7 +297,9 @@ export class ModelingSubmissionComponent implements OnInit, OnDestroy, Component
this.assessmentResult = newResult;
this.assessmentResult = this.modelingAssessmentService.convertResult(newResult);
this.prepareAssessmentData();
this.alertService.info('artemisApp.modelingEditor.newAssessment');
if (this.assessmentResult.assessmentType !== AssessmentType.AUTOMATIC_ATHENA) {
this.alertService.info('artemisApp.modelingEditor.newAssessment');
}
}
});
}
Expand Down

0 comments on commit d8c99a2

Please sign in to comment.