Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 90ec041

Browse files
committed
Update start time on first identification
Currently each session's start time is pegged to whenver you hit the "reset" button, which can be a confusing UI. Instead we'll consider a session as started when you first select a flag.
1 parent 567811b commit 90ec041

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

js/cim.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,13 @@ function select_new_color() {
308308
}
309309
}
310310

311+
function update_start_time_if_needed() {
312+
let stats = get_current_profile().stats;
313+
if (stats.identifications == 0) {
314+
stats.start_time = get_current_timestamp();
315+
}
316+
}
317+
311318
function update_stats(correct_color, chosen_color) {
312319
const correct = correct_color === chosen_color;
313320
let stats = get_current_profile().stats;
@@ -427,6 +434,7 @@ function select_flag(elem) {
427434
const flag_holder = document.getElementById("flag-holder");
428435

429436
_EMOJI_LOCK = true;
437+
update_start_time_if_needed();
430438
update_stats(_CORRECT_COLOR, chosen_color);
431439
update_stats_display();
432440

0 commit comments

Comments
 (0)