summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2022-10-04 08:11:56 -0400
committerAndrew Cady <d@jerkface.net>2022-10-04 08:11:56 -0400
commitccaec90a45492a579159e92926bde2b1e3a91311 (patch)
tree83cfd6f2114add4f47901c8d1244ad5cd634a52b
parent86b0a55b2e28dad14990b1ad419e82f92f0873b8 (diff)
trivial refactor/cleanup/formatting/comment
-rwxr-xr-xrepgoal.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/repgoal.hs b/repgoal.hs
index 480d1e2..28e48a1 100755
--- a/repgoal.hs
+++ b/repgoal.hs
@@ -104,23 +104,26 @@ drawUI () = [a]
104 where 104 where
105 a = vCenter $ hCenter $ renderTable $ table $ 105 a = vCenter $ hCenter $ renderTable $ table $
106 map (padLeftRight 1 . str) ["Lift", "Achieved Best", "Computed 1RM", "Goal Reps", "Goal+1"] : map toRow lifts 106 map (padLeftRight 1 . str) ["Lift", "Achieved Best", "Computed 1RM", "Goal Reps", "Goal+1"] : map toRow lifts
107 toRow x@LiftTarget{..} = 107 toRow target@LiftTarget{..} =
108 let best@Achieved{..} = bestPerformance stats 108 let best@Achieved{..} = bestPerformance stats
109 repGoal = computeRepGoal x 109 repGoal = computeRepGoal target
110 goalTo1RM g = computeOneRepMax $ Achieved g targetWeight 110 goalTo1RM g = computeOneRepMax $ Achieved g targetWeight
111 showGoal g = printf "%d @ %s ≈ 1 @ %s" g (showRational targetWeight) (showRational (goalTo1RM g))
111 in 112 in
112 map (padLeftRight 2) 113 map (padLeftRight 2)
113 [ 114 [
114 txt $ liftName, 115 txt $ liftName,
115 str $ printf "%d @ %s" achievedReps (showRational achievedWeight), 116 str $ printf "%d @ %s" achievedReps (showRational achievedWeight),
116 str $ showRational $ computeOneRepMax best, 117 str $ showRational $ computeOneRepMax best,
117 str $ printf "%d @ %s ≈ 1 @ %s" (repGoal) (showRational targetWeight) (showRational (goalTo1RM repGoal)), 118 str $ showGoal repGoal,
118 str $ printf "%d @ %s ≈ 1 @ %s" (repGoal + 1) (showRational targetWeight) (showRational (goalTo1RM $ repGoal + 1)) 119 str $ showGoal (repGoal + 1)
119 ] 120 ]
120 where
121 121
122-- TODO: State contains chosen repmax formula
123-- TODO: State contains performances
122type St = () 124type St = ()
123 125
126-- TODO: Event for inotify on edited text file (as input interface)
124type CustomEvent = () 127type CustomEvent = ()
125 128
126handleEvent :: St -> BrickEvent () CustomEvent -> EventM () (Next St) 129handleEvent :: St -> BrickEvent () CustomEvent -> EventM () (Next St)