Skip to content

Commit

Permalink
Added a app version result metadata field
Browse files Browse the repository at this point in the history
  • Loading branch information
fruzyna committed Apr 9, 2024
1 parent 03a6094 commit 294bfed
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ function init_page()
navigator.serviceWorker.addEventListener('message', e => {
if (e.data.msg === 'version')
{
let version = e.data.version.replace('wildrank-', '')
let header = document.getElementById('header_info')
header.innerText = e.data.version.replace('wildrank-', '')
header.innerText = version
header.onclick = event => window_open(open_link('about'), '_blank')
set_cookie(VERSION_COOKIE, version)
}
})
}
Expand Down
1 change: 1 addition & 0 deletions scripts/note.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ function get_results_from_page()
results['meta_note_scout_time'] = Math.round(start / 1000)
results['meta_note_scouting_duration'] = (Date.now() - start) / 1000
results['meta_config_version'] = cfg.version
results['meta_app_version'] = get_cookie(VERSION_COOKIE, VERSION_DEFAULT)

// scouting metadata
results['meta_scout_mode'] = NOTE_MODE
Expand Down
1 change: 1 addition & 0 deletions scripts/scout.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ function get_results_from_page()
results['meta_scout_time'] = Math.round(start / 1000)
results['meta_scouting_duration'] = (Date.now() - start) / 1000
results['meta_config_version'] = cfg.version
results['meta_app_version'] = get_cookie(VERSION_COOKIE, VERSION_DEFAULT)
if (scout_mode === MATCH_MODE)
{
results['meta_unsure'] = document.getElementById('unsure').checked
Expand Down
2 changes: 2 additions & 0 deletions scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const PIT_MODE = 'pit'
const NOTE_MODE = 'note'
const MODES = [MATCH_MODE, PIT_MODE, NOTE_MODE]

const VERSION_COOKIE = 'version'
const VERSION_DEFAULT = 'unknown'
const EVENT_COOKIE = 'event_id'
const EVENT_DEFAULT = '2022new'
const USER_COOKIE = 'user_id'
Expand Down

0 comments on commit 294bfed

Please sign in to comment.