A Nix-friendly SQLite-enhanced fork of Flitter, a speedrunning split timer for Unix-style terminals
Revisión | 6ff31367158c4b76a8910eda99c2b16b21ad8f00 (tree) |
---|---|
Tiempo | 2023-06-24 02:01:01 |
Autor | Corbin <cds@corb...> |
Commiter | Corbin |
Remove world-record support.
For posterity: This is the ability to take somebody else's segments and
store them in a way that doesn't associate them with any particular
attempt. I don't like this because it's incompatible with the rest of
the data model, and also breaks an assumption about provenance; but
also, I think that it's unhealthy to compare oneself to the
world-record-holding runners constantly.
@@ -21,10 +21,7 @@ let preamble timer width = | ||
21 | 21 | I.(title <-> category) |
22 | 22 | |
23 | 23 | let splits_header timer width = |
24 | - let labels = | |
25 | - if Option.is_some timer.wr then [ "Delta"; "Sgmt"; "Time"; "WR" ] | |
26 | - else [ "Delta"; "Sgmt"; "Time" ] | |
27 | - in | |
24 | + let labels = [ "Delta"; "Sgmt"; "Time" ] in | |
28 | 25 | |
29 | 26 | let cell_padded = |
30 | 27 | List.map |
@@ -153,36 +150,8 @@ let split_row timer width i = | ||
153 | 150 | in |
154 | 151 | let time_image = plain_duration time in |
155 | 152 | |
156 | - (* Compute the image of the WR comparison cell *) | |
157 | - let wr_image = | |
158 | - Option.map timer.wr ~f:(fun wr_run -> | |
159 | - let default_img = wr_duration wr_run.splits.(i).time in | |
160 | - | |
161 | - if i >= curr_split then default_img | |
162 | - else | |
163 | - (* Determine how much we're ahead or behind WR *) | |
164 | - match timer.state with | |
165 | - | Idle -> default_img | |
166 | - | Timing (splits, _, _) | |
167 | - | Paused (splits, _, _, _) | |
168 | - | Done (splits, _, _) -> ( | |
169 | - match (splits.(i), wr_run.splits.(i).time) with | |
170 | - | Some curr_t, Some wr_t -> | |
171 | - let delta = curr_t - wr_t in | |
172 | - let delta_str = Duration.to_string_plus delta 2 in | |
173 | - let delta_color = | |
174 | - if delta < 0 then Colors.ahead_gain else Colors.behind_gain | |
175 | - in | |
176 | - I.string delta_color delta_str | |
177 | - | _ -> hyphen)) | |
178 | - in | |
179 | - | |
180 | 153 | (* Combine the three time columns together with proper padding *) |
181 | - let time_cells = | |
182 | - match wr_image with | |
183 | - | Some wr -> [ delta_image; sgmt_image; time_image; wr ] | |
184 | - | None -> [ delta_image; sgmt_image; time_image ] | |
185 | - in | |
154 | + let time_cells = [ delta_image; sgmt_image; time_image ] in | |
186 | 155 | let time_cols_combined = |
187 | 156 | List.map time_cells ~f:(left_pad time_col_width) |> I.hcat |
188 | 157 | in |
@@ -26,7 +26,6 @@ type game = { | ||
26 | 26 | split_names : string array; |
27 | 27 | golds : gold array; [@sexp.omit_nil] |
28 | 28 | personal_best : archived_run option; [@sexp.option] |
29 | - world_record : archived_run option; [@sexp.option] | |
30 | 29 | history : archived_run list; [@sexp.omit_nil] |
31 | 30 | } |
32 | 31 | [@@deriving sexp] |
@@ -50,7 +49,6 @@ let game_of_sexp sexp = | ||
50 | 49 | in |
51 | 50 | |
52 | 51 | check_run game.personal_best "Personal best"; |
53 | - check_run game.world_record "World record"; | |
54 | 52 | |
55 | 53 | let history_runs_ok = |
56 | 54 | List.fold game.history ~init:true ~f:(fun all_ok run -> |
@@ -98,7 +96,6 @@ let load_route { title; category } = { title; category; Route.order = None } | ||
98 | 96 | let load filepath = |
99 | 97 | let game = Sexp.load_sexp_conv_exn filepath game_of_sexp in |
100 | 98 | let pb = Option.map ~f:load_run game.personal_best in |
101 | - let wr = Option.map ~f:load_run game.world_record in | |
102 | 99 | let golds = load_golds game in |
103 | 100 | let history = List.map game.history ~f:load_run in |
104 | 101 |
@@ -111,7 +108,6 @@ let load filepath = | ||
111 | 108 | history; |
112 | 109 | comparison = pb; |
113 | 110 | pb; |
114 | - wr; | |
115 | 111 | state = Idle; |
116 | 112 | splits_file = filepath; |
117 | 113 | } |
@@ -140,7 +136,6 @@ let save (timer : Timer_types.timer) = | ||
140 | 136 | in |
141 | 137 | |
142 | 138 | let pb = Option.map ~f:export_run timer.pb in |
143 | - let wr = Option.map ~f:export_run timer.wr in | |
144 | 139 | |
145 | 140 | let history = List.map timer.history ~f:export_run in |
146 | 141 |
@@ -154,7 +149,6 @@ let save (timer : Timer_types.timer) = | ||
154 | 149 | golds = Array.map timer.golds ~f:map_gold; |
155 | 150 | history; |
156 | 151 | personal_best = pb; |
157 | - world_record = wr; | |
158 | 152 | } |
159 | 153 | in |
160 | 154 |
@@ -35,7 +35,6 @@ type timer = { | ||
35 | 35 | history : archived_run list; |
36 | 36 | comparison : archived_run option; |
37 | 37 | pb : archived_run option; |
38 | - wr : archived_run option; | |
39 | 38 | state : live_splits timer_state; |
40 | 39 | splits_file : string; |
41 | 40 | } |
@@ -27,7 +27,6 @@ type timer = { | ||
27 | 27 | history : archived_run list; |
28 | 28 | comparison : archived_run option; |
29 | 29 | pb : archived_run option; |
30 | - wr : archived_run option; | |
31 | 30 | state : live_splits timer_state; |
32 | 31 | splits_file : string; |
33 | 32 | } |