diff --git a/package.yaml b/package.yaml index 0aadd7a3f..70a0a0c90 100644 --- a/package.yaml +++ b/package.yaml @@ -170,6 +170,7 @@ default-extensions: ghc-options: - -Wall - -fno-warn-type-defaults + - -fno-warn-unrecognised-pragmas - -fno-warn-partial-type-signatures when: diff --git a/src/Handler/Admin.hs b/src/Handler/Admin.hs index fa09fba75..3eab2f26c 100644 --- a/src/Handler/Admin.hs +++ b/src/Handler/Admin.hs @@ -198,8 +198,8 @@ postAdminFeaturesR = do (infConflicts,infAmbiguous,infRedundant,infAccepted) <- Candidates.inferHandler unless (null infAmbiguous) $ addMessageI Info $ MsgAmbiguousCandidatesRemoved $ length infAmbiguous unless (null infRedundant) $ addMessageI Info $ MsgRedundantCandidatesRemoved $ length infRedundant - if (null infAccepted) - then addMessageI Info $ MsgNoCandidatesInferred + if null infAccepted + then addMessageI Info MsgNoCandidatesInferred else addMessageI Success $ MsgCandidatesInferred $ length infAccepted return (infConflicts,infAccepted) _other -> (,[]) <$> runDB Candidates.conflicts @@ -263,7 +263,9 @@ postAdminFeaturesR = do ] dbtFilter = mempty dbtFilterUI = mempty - dbtParams = def { dbParamsFormAddSubmit = True } -- dbParamsFormEvaluate = liftHandlerT . (runFormPost . identifyForm "degree-table" - (identForm FIDdegree))} + dbtParams = def { dbParamsFormAddSubmit = True + , dbParamsFormAction = Just . SomeRoute $ AdminFeaturesR :#: ("admin-studydegrees-table-wrapper" :: Text) + } psValidator = def & defaultSorting [SortAscBy "name", SortAscBy "short", SortAscBy "key"] in dbTable psValidator DBTable{..} @@ -290,7 +292,9 @@ postAdminFeaturesR = do ] dbtFilter = mempty dbtFilterUI = mempty - dbtParams = def { dbParamsFormAddSubmit = True } -- , dbParamsFormEvaluate = liftHandlerT . runFormPost } + dbtParams = def { dbParamsFormAddSubmit = True + , dbParamsFormAction = Just . SomeRoute $ AdminFeaturesR :#: ("admin-studyterms-table-wrapper" :: Text) + } psValidator = def & defaultSorting [SortAscBy "name", SortAscBy "short", SortAscBy "key"] in dbTable psValidator DBTable{..} diff --git a/src/Handler/Utils/TermCandidates.hs b/src/Handler/Utils/TermCandidates.hs index fdf91a7f9..0832c343d 100644 --- a/src/Handler/Utils/TermCandidates.hs +++ b/src/Handler/Utils/TermCandidates.hs @@ -27,6 +27,7 @@ import qualified Data.Map as Map import qualified Database.Esqueleto as E -- import Database.Esqueleto.Utils as E +{-# ANN module ("HLint: ignore Use newtype instead of data"::String) #-} type STKey = Int -- for convenience, assmued identical to field StudyTermCandidateKey @@ -62,7 +63,7 @@ inferHandler = runDB $ inferAcc ([],[],[]) redundants <- removeRedundant accepted <- acceptSingletons problems <- conflicts - when (not $ null problems) $ throwM $ FailedCandidateInference problems + unless (null problems) $ throwM $ FailedCandidateInference problems return (ambiguous, redundants, accepted) {- diff --git a/test/Database.hs b/test/Database.hs index 8df98f6e9..c3b83c636 100755 --- a/test/Database.hs +++ b/test/Database.hs @@ -291,9 +291,9 @@ fillDb = do void . insert $ StudyTermCandidate incidence9 79 "Informatik" incidence10 <- liftIO getRandom void . insert $ StudyTermCandidate incidence10 103 "Deutsch" - void . insert $ StudyTermCandidate incidence10 103 "Betriebswirtschafslehre" + void . insert $ StudyTermCandidate incidence10 103 "Betriebswirtschaftslehre" void . insert $ StudyTermCandidate incidence10 21 "Deutsch" - void . insert $ StudyTermCandidate incidence10 21 "Betriebswirtschafslehre" + void . insert $ StudyTermCandidate incidence10 21 "Betriebswirtschaftslehre" incidence11 <- liftIO getRandom void . insert $ StudyTermCandidate incidence11 221 "Bioinformatik" void . insert $ StudyTermCandidate incidence11 221 "Chemie" @@ -306,9 +306,9 @@ fillDb = do void . insert $ StudyTermCandidate incidence11 26 "Biologie" incidence12 <- liftIO getRandom void . insert $ StudyTermCandidate incidence12 103 "Deutsch" - void . insert $ StudyTermCandidate incidence12 103 "Betriebswirtschafslehre" + void . insert $ StudyTermCandidate incidence12 103 "Betriebswirtschaftslehre" void . insert $ StudyTermCandidate incidence12 21 "Deutsch" - void . insert $ StudyTermCandidate incidence12 21 "Betriebswirtschafslehre" + void . insert $ StudyTermCandidate incidence12 21 "Betriebswirtschaftslehre" sfMMp <- insert $ StudyFeatures -- keyword type prevents record syntax here maxMuster