@Chopper,
If you have Open Framework installed, paste the following code in your Javascript console (press F12 and click on the Console tab):
Click to open code
wkof.include('Apiv2');
wkof.ready('Apiv2').then(fetch_data).then(process_data);
function fetch_data() {
return wkof.Apiv2.fetch_endpoint('/reviews');
}
function process_data(json) {
let stages = ['Lessons', 'Apprentice 1', 'Apprentice 2', 'Apprentice 3', 'Apprentice 4', 'Guru 1', 'Guru 2', 'Master', 'Enlightened'];
let reviews = json.data;
let hourCount = new Array(12).fill(0);
let hourCorrect = new Array(12).fill(0);
reviews.forEach(review => {
let hour = new Date(review.data.created_at).getHours();
let bin = Math.floor(hour/2);
hourCount[bin]++;
if (review.data.ending_srs_stage > review.data.starting_srs_stage) {
hourCorrect[bin]++;
}
});
let output = ['Accuracy:'];
for (let i=0; i<12; i++) {
let time = ('0'+(i*2)).slice(-2)+':00 - '+('0'+((i+1)*2)).slice(-2)+':00';
if (hourCount[i] > 0) {
output.push(' '+time+': '+(hourCorrect[i] / hourCount[i] * 100).toFixed(2)+'%');
} else {
output.push(' '+time+': ---');
}
}
console.log(output.join('\n'));
}
You’ll get something like this:
Accuracy:
00:00 - 02:00: 62.22%
02:00 - 04:00: ---
04:00 - 06:00: ---
06:00 - 08:00: 95.24%
08:00 - 10:00: 68.32%
10:00 - 12:00: 69.28%
12:00 - 14:00: 68.22%
14:00 - 16:00: 67.92%
16:00 - 18:00: 67.24%
18:00 - 20:00: 49.93%
20:00 - 22:00: 65.35%
22:00 - 24:00: 61.85%