Skip to content

Commit

Permalink
Fixed statistics menu
Browse files Browse the repository at this point in the history
  • Loading branch information
afonsosousah committed Nov 13, 2024
1 parent 01763e2 commit 1649546
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const TRIP_HISTORY_PAGE_SIZE = 10;
let tokenRefreshed = false;
let minimumDistanceToStation = 50;
let tripHistory = null;

// Define the global user, where the variables will be stored
let user = {};
Expand Down Expand Up @@ -574,6 +575,8 @@ async function openStatisticsMenu() {

// set background to white
menu.style.backgroundColor = "var(--white)";
menu.style.height = "100dvh";
menu.style.width = "100vw";

// show loading animation
menu.innerHTML = `
Expand All @@ -582,7 +585,7 @@ async function openStatisticsMenu() {
`;

// Get user's trip history
const tripHistory = await getTripHistory(1, 10_000);
tripHistory = await getTripHistory(1, 10_000);

if (document.querySelectorAll("#statisticsMenu").length === 0) hideStatisticsMenu();

Expand Down Expand Up @@ -644,7 +647,7 @@ async function openStatisticsMenu() {
document.body.appendChild(menu);

// Populate chart
updateStatisticsChart(tripHistory);
updateStatisticsChart();
}

function hideStatisticsMenu() {
Expand All @@ -660,7 +663,7 @@ function hideStatisticsMenu() {
changeThemeColor("#79c000");
}

function updateStatisticsChart(tripHistory) {
function updateStatisticsChart() {
// Get the selected options
let period = document.getElementById("periodControl").value;
let groupBy = document.getElementById("groupControl").value;
Expand Down

0 comments on commit 1649546

Please sign in to comment.