mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-05 13:27:49 +08:00
fixed activity chart including afk time
rounding up the label text
This commit is contained in:
parent
cae6c60d19
commit
987b40a085
2 changed files with 12 additions and 6 deletions
|
@ -66,7 +66,7 @@ export function getDataAndInit() {
|
|||
CloudFunctions.removeSmallTests({ uid: user.uid });
|
||||
}
|
||||
// if($(".pageAccount").hasClass('active')) update();
|
||||
if($(".pageLogin").hasClass('active')) UI.changePage('account');
|
||||
if ($(".pageLogin").hasClass("active")) UI.changePage("account");
|
||||
if (!UpdateConfig.changedBeforeDb) {
|
||||
if (Config.localStorageConfig === null) {
|
||||
AccountButton.loading(false);
|
||||
|
@ -145,7 +145,7 @@ export function getDataAndInit() {
|
|||
ResultTagsPopup.updateButtons();
|
||||
Settings.showAccountSection();
|
||||
UI.setPageTransition(false);
|
||||
if($(".pageLoading").hasClass('active')) UI.changePage('');
|
||||
if ($(".pageLoading").hasClass("active")) UI.changePage("");
|
||||
})
|
||||
.catch((e) => {
|
||||
AccountButton.loading(false);
|
||||
|
@ -503,12 +503,17 @@ export function update() {
|
|||
if (Object.keys(activityChartData).includes(String(resultDate))) {
|
||||
activityChartData[resultDate].amount++;
|
||||
activityChartData[resultDate].time +=
|
||||
result.testDuration + result.incompleteTestSeconds;
|
||||
result.testDuration +
|
||||
result.incompleteTestSeconds -
|
||||
result.afkDuration;
|
||||
activityChartData[resultDate].totalWpm += result.wpm;
|
||||
} else {
|
||||
activityChartData[resultDate] = {
|
||||
amount: 1,
|
||||
time: result.testDuration + result.incompleteTestSeconds,
|
||||
time:
|
||||
result.testDuration +
|
||||
result.incompleteTestSeconds -
|
||||
result.afkDuration,
|
||||
totalWpm: result.wpm,
|
||||
};
|
||||
}
|
||||
|
@ -838,7 +843,7 @@ $(".pageAccount #accountHistoryChart").click((e) => {
|
|||
loadMoreLines(index);
|
||||
$([document.documentElement, document.body]).animate(
|
||||
{
|
||||
scrollTop: $(`#result-${index}`).offset().top - ($(window).height()/2),
|
||||
scrollTop: $(`#result-${index}`).offset().top - $(window).height() / 2,
|
||||
},
|
||||
500
|
||||
);
|
||||
|
|
|
@ -364,7 +364,8 @@ export let accountActivity = new Chart(
|
|||
data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];
|
||||
if (tooltipItem.datasetIndex === 0) {
|
||||
return `Time Typing: ${Misc.secondsToString(
|
||||
resultData.y
|
||||
Math.round(resultData.y),
|
||||
true
|
||||
)}\nTests Completed: ${resultData.amount}`;
|
||||
} else if (tooltipItem.datasetIndex === 1) {
|
||||
return `Average Wpm: ${Misc.roundTo2(resultData.y)}`;
|
||||
|
|
Loading…
Reference in a new issue