diff --git a/messages/faq/de-de-formal.msg b/messages/faq/de-de-formal.msg index 67db65216..092366c09 100644 --- a/messages/faq/de-de-formal.msg +++ b/messages/faq/de-de-formal.msg @@ -2,4 +2,5 @@ FAQNoCampusAccount: Ich habe keine LMU-Benutzerkennung (ehem. Campus-Kennung); k FAQForgottenPassword: Ich habe mein Passwort vergessen FAQCampusCantLogin: Ich kann mich mit meiner LMU-Benutzerkennung (ehem. Campus-Kennung) nicht anmelden FAQCourseCorrectorsTutors: Wie kann ich Tutoren oder Korrektoren für meinen Kurs einstellen? -FAQNotLecturerHowToCreateCourses: Wie kann ich einen neuen Kurs anlegen? \ No newline at end of file +FAQNotLecturerHowToCreateCourses: Wie kann ich einen neuen Kurs anlegen? +FAQExamPoints: Warum kann ich bei meiner Klausur keine Punkte eintragen? \ No newline at end of file diff --git a/messages/faq/en-eu.msg b/messages/faq/en-eu.msg index 7c0c3d80e..1cce5d04b 100644 --- a/messages/faq/en-eu.msg +++ b/messages/faq/en-eu.msg @@ -3,3 +3,4 @@ FAQForgottenPassword: I have forgotten my password FAQCampusCantLogin: I can't log in using my LMU user ID (formerly Campus-ID) FAQCourseCorrectorsTutors: How can I add tutors or correctors to my course? FAQNotLecturerHowToCreateCourses: How can I create new courses? +FAQExamPoints: Why can't I enter achievements for my exam as points? diff --git a/src/Database/Esqueleto/Utils.hs b/src/Database/Esqueleto/Utils.hs index 80e5334a3..c94b61c08 100644 --- a/src/Database/Esqueleto/Utils.hs +++ b/src/Database/Esqueleto/Utils.hs @@ -14,7 +14,7 @@ module Database.Esqueleto.Utils , orderByList , orderByOrd, orderByEnum , strip, lower, ciEq - , selectExists + , selectExists, selectNotExists , SqlHashable , sha256 , maybe, unsafeCoalesce @@ -206,13 +206,14 @@ ciEq :: E.SqlString s => E.SqlExpr (E.Value s) -> E.SqlExpr (E.Value s) -> E.Sql ciEq a b = lower a E.==. lower b -selectExists :: forall m a. MonadIO m => E.SqlQuery a -> E.SqlReadT m Bool +selectExists, selectNotExists :: forall m a. MonadIO m => E.SqlQuery a -> E.SqlReadT m Bool selectExists query = do res <- E.select . return . E.exists $ void query case res of [E.Value b] -> return b _other -> error "SELECT EXISTS ... returned zero or more than one rows" +selectNotExists = fmap not . selectExists class SqlHashable a diff --git a/src/Handler/Info.hs b/src/Handler/Info.hs index 0414808ca..acb282192 100644 --- a/src/Handler/Info.hs +++ b/src/Handler/Info.hs @@ -7,6 +7,9 @@ import Handler.Info.TH import qualified Data.Map as Map import qualified Data.CaseInsensitive as CI +import qualified Database.Esqueleto as E +import qualified Database.Esqueleto.Utils as E + import Development.GitRev -- | Versionsgeschichte @@ -156,6 +159,17 @@ showFAQ (CourseR tid ssh csh _) FAQCourseCorrectorsTutors (or2M (hasWriteAccessTo $ CourseR tid ssh csh SheetNewR) (hasWriteAccessTo $ CourseR tid ssh csh CTutorialNewR) ) +showFAQ (CExamR tid ssh csh examn _) FAQExamPoints + = and2M (hasWriteAccessTo $ CExamR tid ssh csh examn EEditR) + noExamParts + where + noExamParts = liftHandler . runDB . E.selectNotExists . E.from $ \(examPart `E.InnerJoin` exam `E.InnerJoin` course) -> do + E.on $ course E.^. CourseId E.==. exam E.^. ExamCourse + E.on $ exam E.^. ExamId E.==. examPart E.^. ExamPartExam + E.where_ $ course E.^. CourseTerm E.==. E.val tid + E.&&. course E.^. CourseSchool E.==. E.val ssh + E.&&. course E.^. CourseShorthand E.==. E.val csh + E.&&. exam E.^. ExamName E.==. E.val examn showFAQ _ _ = return False prioFAQ :: Monad m @@ -165,3 +179,4 @@ prioFAQ _ FAQCampusCantLogin = return 1 prioFAQ _ FAQForgottenPassword = return 1 prioFAQ _ FAQNotLecturerHowToCreateCourses = return 1 prioFAQ _ FAQCourseCorrectorsTutors = return 1 +prioFAQ _ FAQExamPoints = return 2 diff --git a/templates/i18n/faq/exam-points.de-de-formal.hamlet b/templates/i18n/faq/exam-points.de-de-formal.hamlet new file mode 100644 index 000000000..a88e6f7f9 --- /dev/null +++ b/templates/i18n/faq/exam-points.de-de-formal.hamlet @@ -0,0 +1,9 @@ +$newline never + +

+ Klausurpunkte werden in Uni2work pro Teilaufgabe verwaltet. + +

+ Um Klausurleistungen als Punkte anzugeben (und optional automatisch # + eine Note daraus zu berechnen), müssen Sie mindestens eine # + Teilprüfung/Aufgabe anlegen. diff --git a/templates/i18n/faq/exam-points.en-eu.hamlet b/templates/i18n/faq/exam-points.en-eu.hamlet new file mode 100644 index 000000000..1fec1a5b4 --- /dev/null +++ b/templates/i18n/faq/exam-points.en-eu.hamlet @@ -0,0 +1,9 @@ +$newline never + +

+ Exam points are managed in Uni2work on a per-exam-part basis. + +

+ To store exam achievements in the form of points (and optionally # + automatically compute grades), you need to create at least one # + exam part/question.