Matrikelnummern bei Abgaben anzeigen, RenderMessage Instanz für Load überarbeitet.
This commit is contained in:
parent
fe926b116f
commit
27cbff2aaa
@ -169,9 +169,11 @@ Corrector: Korrektor
|
|||||||
Correctors: Korrektoren
|
Correctors: Korrektoren
|
||||||
CorState: Status
|
CorState: Status
|
||||||
CorByTut: Nach Tutorium
|
CorByTut: Nach Tutorium
|
||||||
Tutorial: Tutorium
|
|
||||||
CorProportion: Anteil
|
CorProportion: Anteil
|
||||||
CorrectionProportion: Anteile
|
CorByProportionOnly proportion@Rational: #{display proportion} Anteile
|
||||||
|
CorByProportionIncludingTutorial proportion@Rational: #{display proportion} Anteile - Tutorium
|
||||||
|
CorByProportionExcludingTutorial proportion@Rational: #{display proportion} Anteile + Tutorium
|
||||||
|
|
||||||
DeleteRow: Zeile entfernen
|
DeleteRow: Zeile entfernen
|
||||||
ProportionNegative: Anteile dürfen nicht negativ sein
|
ProportionNegative: Anteile dürfen nicht negativ sein
|
||||||
CorrectorsUpdated: Korrektoren erfolgreich aktualisiert
|
CorrectorsUpdated: Korrektoren erfolgreich aktualisiert
|
||||||
|
|||||||
@ -207,22 +207,12 @@ instance RenderMessage UniWorX CorrectorState where
|
|||||||
|
|
||||||
|
|
||||||
instance RenderMessage UniWorX Load where
|
instance RenderMessage UniWorX Load where
|
||||||
renderMessage foundation ls (Load {..}) = loadText <> tutorialText
|
renderMessage foundation ls = \case
|
||||||
where
|
(Load {byTutorial=Nothing , byProportion=p}) -> renderMessage' $ MsgCorByProportionOnly p
|
||||||
loadText = if byProportion > 0
|
(Load {byTutorial=Just True , byProportion=p}) -> renderMessage' $ MsgCorByProportionIncludingTutorial p
|
||||||
then (tshow $ fromRational byProportion) <> " " <> renderMessage' MsgCorrectionProportion
|
(Load {byTutorial=Just False, byProportion=p}) -> renderMessage' $ MsgCorByProportionExcludingTutorial p
|
||||||
else mempty
|
where renderMessage' = renderMessage foundation ls
|
||||||
|
|
||||||
tutorialText = case byTutorial of
|
|
||||||
Nothing -> mempty
|
|
||||||
(Just plusLoad) ->
|
|
||||||
let connector = if
|
|
||||||
| loadText == mempty -> mempty
|
|
||||||
| plusLoad -> " - "
|
|
||||||
| otherwise -> " + "
|
|
||||||
in connector <> renderMessage' MsgTutorial
|
|
||||||
|
|
||||||
renderMessage' = renderMessage foundation ls
|
|
||||||
|
|
||||||
instance RenderMessage UniWorX (UnsupportedAuthPredicate (Route UniWorX)) where
|
instance RenderMessage UniWorX (UnsupportedAuthPredicate (Route UniWorX)) where
|
||||||
renderMessage f ls (UnsupportedAuthPredicate tag route) = renderMessage f ls $ MsgUnsupportedAuthPredicate tag (show route)
|
renderMessage f ls (UnsupportedAuthPredicate tag route) = renderMessage f ls $ MsgUnsupportedAuthPredicate tag (show route)
|
||||||
|
|||||||
@ -125,6 +125,11 @@ colSubmittors :: IsDBTable m a => Colonnade _ CorrectionTableData (DBCell m a)
|
|||||||
colSubmittors = sortable Nothing (i18nCell MsgSubmissionUsers) $ \DBRow{ dbrOutput=(_, _, _, _, users) } -> let
|
colSubmittors = sortable Nothing (i18nCell MsgSubmissionUsers) $ \DBRow{ dbrOutput=(_, _, _, _, users) } -> let
|
||||||
cell = listCell (Map.toList users) $ \(userId, User{..}) -> anchorCellM (AdminUserR <$> encrypt userId) (toWidget userDisplayName)
|
cell = listCell (Map.toList users) $ \(userId, User{..}) -> anchorCellM (AdminUserR <$> encrypt userId) (toWidget userDisplayName)
|
||||||
in cell & cellAttrs <>~ [("class", "list--inline list--comma-separated")]
|
in cell & cellAttrs <>~ [("class", "list--inline list--comma-separated")]
|
||||||
|
|
||||||
|
colSMatrikel :: IsDBTable m a => Colonnade _ CorrectionTableData (DBCell m a)
|
||||||
|
colSMatrikel = sortable Nothing (i18nCell MsgMatrikelNr) $ \DBRow{ dbrOutput=(_, _, _, _, users) } -> let
|
||||||
|
cell = listCell (Map.toList users) $ \(userId, User{..}) -> anchorCellM (AdminUserR <$> encrypt userId) (maybe mempty toWidget userMatrikelnummer)
|
||||||
|
in cell & cellAttrs <>~ [("class", "list--inline list--comma-separated")]
|
||||||
|
|
||||||
colRating :: IsDBTable m a => Colonnade _ CorrectionTableData (DBCell m a)
|
colRating :: IsDBTable m a => Colonnade _ CorrectionTableData (DBCell m a)
|
||||||
colRating = sortable (Just "rating") (i18nCell MsgRating) $ \DBRow{ dbrOutput=(Entity subId Submission{..}, Entity _ Sheet{..}, course, _, _) } ->
|
colRating = sortable (Just "rating") (i18nCell MsgRating) $ \DBRow{ dbrOutput=(Entity subId Submission{..}, Entity _ Sheet{..}, course, _, _) } ->
|
||||||
@ -354,6 +359,7 @@ postCCorrectionsR tid ssh csh = do
|
|||||||
, dbRow
|
, dbRow
|
||||||
, colSheet
|
, colSheet
|
||||||
, colCorrector
|
, colCorrector
|
||||||
|
, colSMatrikel
|
||||||
, colSubmittors
|
, colSubmittors
|
||||||
, colSubmissionLink
|
, colSubmissionLink
|
||||||
, colRating
|
, colRating
|
||||||
|
|||||||
12
src/Utils.hs
12
src/Utils.hs
@ -27,6 +27,9 @@ import Utils.PathPiece as Utils
|
|||||||
|
|
||||||
import Text.Blaze (Markup, ToMarkup)
|
import Text.Blaze (Markup, ToMarkup)
|
||||||
|
|
||||||
|
import Data.Text (dropWhileEnd)
|
||||||
|
import Numeric (showFFloat)
|
||||||
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Data.Set (Set)
|
import Data.Set (Set)
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
@ -136,6 +139,15 @@ instance DisplayAble a => DisplayAble (Maybe a) where
|
|||||||
display Nothing = ""
|
display Nothing = ""
|
||||||
display (Just x) = display x
|
display (Just x) = display x
|
||||||
|
|
||||||
|
instance DisplayAble Rational where
|
||||||
|
display r = showFFloat (Just 2) (rat2float r) ""
|
||||||
|
& pack
|
||||||
|
& dropWhileEnd ('0'==)
|
||||||
|
& dropWhileEnd ('.'==)
|
||||||
|
where
|
||||||
|
rat2float :: Rational -> Double
|
||||||
|
rat2float = fromRational
|
||||||
|
|
||||||
instance DisplayAble a => DisplayAble (E.Value a) where
|
instance DisplayAble a => DisplayAble (E.Value a) where
|
||||||
display = display . E.unValue
|
display = display . E.unValue
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user