Skip to content

Commit

Permalink
Update start time on first identification
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pganssle committed Dec 1, 2024
1 parent 567811b commit 90ec041
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions js/cim.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,13 @@ function select_new_color() {
}
}

function update_start_time_if_needed() {
let stats = get_current_profile().stats;
if (stats.identifications == 0) {
stats.start_time = get_current_timestamp();
}
}

function update_stats(correct_color, chosen_color) {
const correct = correct_color === chosen_color;
let stats = get_current_profile().stats;
Expand Down Expand Up @@ -427,6 +434,7 @@ function select_flag(elem) {
const flag_holder = document.getElementById("flag-holder");

_EMOJI_LOCK = true;
update_start_time_if_needed();
update_stats(_CORRECT_COLOR, chosen_color);
update_stats_display();

Expand Down

0 comments on commit 90ec041

Please sign in to comment.