From aef7fad5d8c130a5297298fd229c054b78d0e27f Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 26 Feb 2020 21:07:04 +0100 Subject: [PATCH] style(participant-intersect): improve display --- src/Handler/Participants.hs | 6 ++++-- templates/participants-intersect.hamlet | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Handler/Participants.hs b/src/Handler/Participants.hs index d710903b7..5cd14f224 100644 --- a/src/Handler/Participants.hs +++ b/src/Handler/Participants.hs @@ -140,10 +140,12 @@ postParticipantsIntersectR = do intersectionHotness :: _ -> _ -> _ -> Centi intersectionHotness intersections lCid uCid | sumSize == 0 = 0 - | otherwise = realToFrac . max 0 . min 1 $ 2 * intersectSize % sumSize + | intersectSize == 0 = 0 + | otherwise = realToFrac . (0.5 +) . (0.5 *) . max 0 . min 1 $ 2 * intersectSize % sumSize where - sumSize = intersections ! (lCid, lCid) + intersections ! (uCid, uCid) + sumSize = (min `on` (intersections !)) (lCid, lCid) (uCid, uCid) intersectSize = symmIntersection intersections lCid uCid + showNumber n lCid uCid = n /= 0 || lCid == uCid lIxed = zip [0..] diff --git a/templates/participants-intersect.hamlet b/templates/participants-intersect.hamlet index f5e834c7d..5e24254ed 100644 --- a/templates/participants-intersect.hamlet +++ b/templates/participants-intersect.hamlet @@ -22,5 +22,5 @@ $maybe (courses, intersections) <- intersectionsRes $else $with n <- symmIntersection intersections lCid uCid - $if n /= 0 + $if showNumber n lCid uCid #{n}