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

Assessment: Fix an issue where instructors accidentally override presentation scores #10143

Merged
merged 4 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -591,14 +591,6 @@ public boolean getComplaintsEnabled() {
return this.maxComplaintTimeDays > 0;
}

public Set<Post> getPosts() {
return posts;
}

public void setPosts(Set<Post> posts) {
this.posts = posts;
}

public boolean getRequestMoreFeedbackEnabled() {
return maxRequestMoreFeedbackTimeDays > 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import de.tum.cit.aet.artemis.assessment.service.AssessmentDashboardService;
import de.tum.cit.aet.artemis.assessment.service.ComplaintService;
import de.tum.cit.aet.artemis.assessment.service.CourseScoreCalculationService;
import de.tum.cit.aet.artemis.assessment.service.GradingScaleService;
import de.tum.cit.aet.artemis.athena.service.AthenaModuleService;
import de.tum.cit.aet.artemis.atlas.api.LearnerProfileApi;
import de.tum.cit.aet.artemis.atlas.api.LearningPathApi;
Expand Down Expand Up @@ -170,8 +169,6 @@ public class CourseResource {

private final TutorialGroupsConfigurationService tutorialGroupsConfigurationService;

private final GradingScaleService gradingScaleService;

private final CourseScoreCalculationService courseScoreCalculationService;

private final GradingScaleRepository gradingScaleRepository;
Expand All @@ -197,10 +194,10 @@ public CourseResource(UserRepository userRepository, CourseService courseService
Optional<OnlineCourseConfigurationService> onlineCourseConfigurationService, AuthorizationCheckService authCheckService,
TutorParticipationRepository tutorParticipationRepository, SubmissionService submissionService, Optional<VcsUserManagementService> optionalVcsUserManagementService,
AssessmentDashboardService assessmentDashboardService, ExerciseRepository exerciseRepository, Optional<CIUserManagementService> optionalCiUserManagementService,
FileService fileService, TutorialGroupsConfigurationService tutorialGroupsConfigurationService, GradingScaleService gradingScaleService,
CourseScoreCalculationService courseScoreCalculationService, GradingScaleRepository gradingScaleRepository, LearningPathApi learningPathApi,
ConductAgreementService conductAgreementService, Optional<AthenaModuleService> athenaModuleService, ExamRepository examRepository, ComplaintService complaintService,
TeamRepository teamRepository, LearnerProfileApi learnerProfileApi) {
FileService fileService, TutorialGroupsConfigurationService tutorialGroupsConfigurationService, CourseScoreCalculationService courseScoreCalculationService,
GradingScaleRepository gradingScaleRepository, LearningPathApi learningPathApi, ConductAgreementService conductAgreementService,
Optional<AthenaModuleService> athenaModuleService, ExamRepository examRepository, ComplaintService complaintService, TeamRepository teamRepository,
LearnerProfileApi learnerProfileApi) {
this.courseService = courseService;
this.courseRepository = courseRepository;
this.exerciseService = exerciseService;
Expand All @@ -215,7 +212,6 @@ public CourseResource(UserRepository userRepository, CourseService courseService
this.exerciseRepository = exerciseRepository;
this.fileService = fileService;
this.tutorialGroupsConfigurationService = tutorialGroupsConfigurationService;
this.gradingScaleService = gradingScaleService;
this.courseScoreCalculationService = courseScoreCalculationService;
this.gradingScaleRepository = gradingScaleRepository;
this.learningPathApi = learningPathApi;
Expand Down Expand Up @@ -278,17 +274,6 @@ public ResponseEntity<Course> updateCourse(@PathVariable Long courseId, @Request
}
}

if (courseUpdate.getPresentationScore() != null && courseUpdate.getPresentationScore() != 0) {
Optional<GradingScale> gradingScale = gradingScaleService.findGradingScaleByCourseId(courseUpdate.getId());
if (gradingScale.isPresent() && gradingScale.get().getPresentationsNumber() != null) {
throw new BadRequestAlertException("You cannot set a presentation score if the grading scale is already set up for graded presentations", Course.ENTITY_NAME,
"gradedPresentationAlreadySet", true);
}
if (courseUpdate.getPresentationScore() < 0) {
throw new BadRequestAlertException("The presentation score cannot be negative", Course.ENTITY_NAME, "negativePresentationScore", true);
}
}

// Make sure to preserve associations in updated entity
courseUpdate.setId(courseId);
courseUpdate.setPrerequisites(existingCourse.getPrerequisites());
Expand Down Expand Up @@ -1353,7 +1338,7 @@ public ResponseEntity<Void> removeUserFromCourseGroup(String userLogin, User ins
public ResponseEntity<CourseManagementDetailViewDTO> getCourseDTOForDetailView(@PathVariable Long courseId) {
Course course = courseRepository.findByIdElseThrow(courseId);
authCheckService.checkHasAtLeastRoleInCourseElseThrow(Role.TEACHING_ASSISTANT, course, null);
GradingScale gradingScale = gradingScaleService.findGradingScaleByCourseId(courseId).orElse(null);
GradingScale gradingScale = gradingScaleRepository.findByCourseId(courseId).orElse(null);
CourseManagementDetailViewDTO managementDetailViewDTO = courseService.getStatsForDetailView(course, gradingScale);
return ResponseEntity.ok(managementDetailViewDTO);
}
Expand Down
11 changes: 7 additions & 4 deletions src/main/webapp/app/course/manage/course-update.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,15 +326,18 @@ export class CourseUpdateComponent implements OnInit {
file = base64StringToBlob(base64Data, 'image/*');
}

const course = this.courseForm.getRawValue();
const course = this.courseForm.getRawValue() as Course;
// NOTE: prevent overriding this value accidentally
// TODO: move presentationScore to gradingScale to avoid this
course.presentationScore = this.course.presentationScore;

if (this.communicationEnabled && this.messagingEnabled) {
course['courseInformationSharingConfiguration'] = CourseInformationSharingConfiguration.COMMUNICATION_AND_MESSAGING;
course.courseInformationSharingConfiguration = CourseInformationSharingConfiguration.COMMUNICATION_AND_MESSAGING;
} else if (this.communicationEnabled && !this.messagingEnabled) {
course['courseInformationSharingConfiguration'] = CourseInformationSharingConfiguration.COMMUNICATION_ONLY;
course.courseInformationSharingConfiguration = CourseInformationSharingConfiguration.COMMUNICATION_ONLY;
} else {
this.communicationEnabled = false;
course['courseInformationSharingConfiguration'] = CourseInformationSharingConfiguration.DISABLED;
course.courseInformationSharingConfiguration = CourseInformationSharingConfiguration.DISABLED;
}

if (!course.enrollmentEnabled) {
Expand Down
Loading