From 00a6ca83bcc096075b65a70cf18860c1d7bf5a6b Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 27 Aug 2019 08:51:02 +0200 Subject: [PATCH] fix(course-edit): only show allocation error message when relevant --- messages/uniworx/de.msg | 2 +- src/Handler/Course/Edit.hs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/messages/uniworx/de.msg b/messages/uniworx/de.msg index 737f60890..8568ce0e3 100644 --- a/messages/uniworx/de.msg +++ b/messages/uniworx/de.msg @@ -211,7 +211,7 @@ CourseApplicationsAllocatedDirectory: zentral CourseApplicationsNotAllocatedDirectory: direkt CourseNoAllocationsAvailable: Es sind aktuell keine Zentralanmeldungen verfügbar -AllocationStaffRegisterToExpired: Es dürfen keine Änderungen an der Eintragung des Kurses zur Zentralanmeldung mehr vorgenommen werden +AllocationStaffRegisterToExpired: Es dürfen keine Änderungen an der Eintragung des Kurses zur Zentralanmeldung mehr vorgenommen werden. Ihre Änderungen wurden ignoriert. CourseFormSectionRegistration: Anmeldung zum Kurs diff --git a/src/Handler/Course/Edit.hs b/src/Handler/Course/Edit.hs index ce9d0e422..248c17571 100644 --- a/src/Handler/Course/Edit.hs +++ b/src/Handler/Course/Edit.hs @@ -541,7 +541,15 @@ upsertAllocationCourse cid cfAllocation = do -> return True | Just Allocation{allocationStaffRegisterTo} <- prevAllocation , NTop allocationStaffRegisterTo <= NTop (Just now) - -> False <$ addMessageI Error MsgAllocationStaffRegisterToExpired + -> let anyChanges + | Just AllocationCourseForm{..} <- cfAllocation + , Just (Entity _ AllocationCourse{..}) <- prevAllocationCourse + = or [ acfAllocation /= allocationCourseAllocation + , acfMinCapacity /= allocationCourseMinCapacity + ] + | otherwise + = True + in False <$ when anyChanges (addMessageI Error MsgAllocationStaffRegisterToExpired) | otherwise -> return True