feat(participants): first finished verson

This commit is contained in:
ros 2021-05-24 11:45:28 +02:00
parent 3b20ec27aa
commit 0a3fd23e22
6 changed files with 22 additions and 8 deletions

View File

@ -5,4 +5,6 @@ ParticipantsIntersectCourseOption tid@TermId ssh@SchoolId coursen@CourseName !id
ParticipantsIntersectCourses: Kurse
CourseParticipantsRegisteredWithoutField n@Int: #{n} #{pluralDE n "Teilnehmeri:in wurde ohne assoziiertes Studienfach" "Teilnehmer:innen wurden ohne assoziierte Studienfächer"} angemeldet, da #{pluralDE n "kein eindeutiges Hauptfach bestimmt werden konnte" "keine eindeutigen Hauptfächer bestimmt werden konnten"}
ParticipantsCsvSheetName tid@TermId ssh@SchoolId: #{foldCase (termToText (unTermKey tid))}-#{foldedCase (unSchoolKey ssh)} Kursteilnehmer:innen
CourseParticipants n@Int: Derzeit #{n} angemeldete Kursteilnehmer:innen
CourseParticipants n@Int: Derzeit #{n} angemeldete Kursteilnehmer:innen
ParticipantsIntersectNotOne: Schnitt
AllUsers: Vereinigung aller Teilnehmer:innen:

View File

@ -6,3 +6,5 @@ ParticipantsIntersectCourses: Courses
CourseParticipantsRegisteredWithoutField n: #{n} #{pluralEN n "participant was" "participants were"} registered without #{pluralEN n "an associated field of study" "associated fields of study"}, because #{pluralEN n "it" "they"} could not be determined uniquely.
ParticipantsCsvSheetName tid ssh: #{foldCase (termToText (unTermKey tid))}-#{foldedCase (unSchoolKey ssh)} Participants
CourseParticipants n: Currently #{n} course #{pluralEN n "participant" "participants"}
ParticipantsIntersectNotOne: Intersection
AllUsers: Union of all participants:

View File

@ -708,4 +708,3 @@ addPWEntry User{ userAuthentication = _, ..} (Text.encodeUtf8 -> pw) = db' $ do
PWHashConf{..} <- getsYesod $ view _appAuthPWHash
(AuthPWHash . Text.decodeUtf8 -> userAuthentication) <- liftIO $ makePasswordWith pwHashAlgorithm pw pwHashStrength
void $ insert User{..}

View File

@ -110,9 +110,9 @@ postParticipantsIntersectR = do
-> Set.size $ Map.findWithDefault Set.empty lCid courseUsers `Set.intersection` Map.findWithDefault Set.empty uCid courseUsers
selfIntersections = Map.mapKeysMonotonic (\cid -> (cid, cid)) $ Set.size <$> courseUsers
intersections' = Map.union intersections selfIntersections
-- let allUsers = setUnionAll $ Map.elems courseUsers
-- let mapIntersect = mapIntersectNotOne courseUsers
return (courses, intersections')
let allUsers = setUnionAll $ Map.elems courseUsers
let mapIntersect = mapIntersectNotOne courseUsers
return (courses, intersections', mapIntersect, allUsers)
let
symmIntersection intersections lCid uCid = fromMaybe 0 $ intersections !? (lCid, uCid) <|> intersections !? (uCid, lCid)

View File

@ -36,7 +36,10 @@ setUnionOthers [] = Set.empty
setUnionOthers [x] = x
setUnionOthers (x:y:z) = setUnionOthers (xy:z) where xy = Set.union x y
-- Fkt für Tabelle
----------------------------------
-- Functions fro Particiants.hs --
----------------------------------
-- | list of values of a Map with Sets as values
getAllUserIdsSetList :: Map.Map a (Set b) -> [Set b]
getAllUserIdsSetList m = loop (Map.toList m) [] where

View File

@ -1,7 +1,7 @@
$newline never
<section>
^{formWidget}
$maybe (courses, intersections) <- intersectionsRes
$maybe (courses, intersections, mapIntersect, allUsers) <- intersectionsRes
<section>
<div .scrolltable .scrolltable--bordered>
<table .table .table--hover .table--condensed>
@ -11,6 +11,8 @@ $maybe (courses, intersections) <- intersectionsRes
$forall Entity _ Course{courseTerm, courseSchool, courseShorthand} <- courses
<th .table__th .text--center>
#{courseTerm}-#{courseSchool}-#{courseShorthand}
<th .table__th .text--center>
_{MsgParticipantsIntersectNotOne}
<tbody>
$forall (l, Entity lCid Course{courseTerm, courseSchool, courseShorthand}) <- lIxed courses
<tr .table__row>
@ -23,4 +25,10 @@ $maybe (courses, intersections) <- intersectionsRes
$with n <- symmIntersection intersections lCid uCid
<td .table__td .text--center :uCid == lCid:.table__td--automatic :uCid /= lCid:.heated :uCid /= lCid:style="--hotness: #{toPathPiece (intersectionHotness intersections lCid uCid)}">
$if showNumber n lCid uCid
#{n}
#{n}
$maybe num <- Map.lookup lCid mapIntersect
<td .table__td .text--center .table__td--automatic>
#{num}
<p>
_{MsgAllUsers}
#{allUsers}