summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2022-11-03 12:06:04 -0400
committerAndrew Cady <d@jerkface.net>2022-11-03 12:06:04 -0400
commitfa09e6ce131e9669baca8ce2562fe87dd1f43528 (patch)
treebfd72f77b2e021293c93f1690dd0da1399e7a088
parentdc5a8f2b008d20491b81108a3eccd24e23f379ac (diff)
rename
-rwxr-xr-xrepgoal.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/repgoal.hs b/repgoal.hs
index ab50b67..5a4e6e4 100755
--- a/repgoal.hs
+++ b/repgoal.hs
@@ -83,7 +83,7 @@ data Performance = Achieved {
83} deriving Generic deriving (Read, Show) via Surgery Derecordify Performance 83} deriving Generic deriving (Read, Show) via Surgery Derecordify Performance
84 84
85data LiftRecord = LiftRecord { 85data LiftRecord = LiftRecord {
86 liftName :: Text, 86 liftRecordName :: Text,
87 stats :: [Performance] 87 stats :: [Performance]
88} deriving Generic deriving (Read, Show) via Surgery Derecordify LiftRecord 88} deriving Generic deriving (Read, Show) via Surgery Derecordify LiftRecord
89 89
@@ -164,20 +164,20 @@ lookup' i seq = fromJust $ NESeq.lookup (i `mod` NESeq.length seq) seq
164drawUI :: St -> [Widget ()] 164drawUI :: St -> [Widget ()]
165drawUI st = [vCenter $ vBox [hCenter $ hBox [header, oneRepMaxTable], withVScrollBarHandles $ withVScrollBars OnRight $ viewport () Vertical $ hCenter lastSetTable]] 165drawUI st = [vCenter $ vBox [hCenter $ hBox [header, oneRepMaxTable], withVScrollBarHandles $ withVScrollBars OnRight $ viewport () Vertical $ hCenter lastSetTable]]
166 where 166 where
167 lifts' = filter ((flip Set.member $ view sessions st & lookup' (view selectedSession st)) . liftName) (view lifts st) 167 lifts' = filter ((flip Set.member $ view sessions st & lookup' (view selectedSession st)) . liftRecordName) (view lifts st)
168 lastSetTable = renderTable $ table $ map (padLeftRight 1 . txt) ["Lift", "Set", "Plates", "Goal", "Done", "Rest"] : concatMap (toLiftRows (view week st)) lifts' 168 lastSetTable = renderTable $ table $ map (padLeftRight 1 . txt) ["Lift", "Set", "Plates", "Goal", "Done", "Rest"] : concatMap (toLiftRows (view week st)) lifts'
169 header = renderTable $ table $ map (padLeftRight 1 . txt) 169 header = renderTable $ table $ map (padLeftRight 1 . txt)
170 ["Date", "Time", "Bodyweight", "Week", "Session"] 170 ["Date", "Time", "Bodyweight", "Week", "Session"]
171 : [ map (padLeftRight 2 . txt) [" ", " ", " ", weekNumber, sessionName] ] 171 : [ map (padLeftRight 2 . txt) [" ", " ", " ", weekNumber, sessionName] ]
172 weekNumber = case (view week st) of Week1 -> "1"; Week2 -> "2"; Week3 -> "3" 172 weekNumber = case (view week st) of Week1 -> "1"; Week2 -> "2"; Week3 -> "3"
173 sessionName = liftName $ head lifts' 173 sessionName = liftRecordName $ head lifts'
174 oneRepMaxTable = renderTable $ table $ map (padLeftRight 1 . txt) ["Lift", "Achieved Best", "Computed 1RM"] : map toRow lifts' 174 oneRepMaxTable = renderTable $ table $ map (padLeftRight 1 . txt) ["Lift", "Achieved Best", "Computed 1RM"] : map toRow lifts'
175 toRow LiftRecord{..} = 175 toRow LiftRecord{..} =
176 let best@Achieved{..} = bestPerformance stats 176 let best@Achieved{..} = bestPerformance stats
177 in 177 in
178 map (padLeftRight 2) 178 map (padLeftRight 2)
179 [ 179 [
180 txt $ liftName, 180 txt $ liftRecordName,
181 str $ printf "%d @ %d" achievedReps achievedWeight, 181 str $ printf "%d @ %d" achievedReps achievedWeight,
182 str $ showRational $ computeOneRepMax best 182 str $ showRational $ computeOneRepMax best
183 ] 183 ]