From fec6c2ff72366dbf60367d36b3e9f973ce615edd Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 4 Jun 2024 16:27:35 -0700 Subject: [PATCH] removed comments --- app/assets/javascripts/chartDashboard.js | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/app/assets/javascripts/chartDashboard.js b/app/assets/javascripts/chartDashboard.js index adc9ea255..98378137a 100644 --- a/app/assets/javascripts/chartDashboard.js +++ b/app/assets/javascripts/chartDashboard.js @@ -6,14 +6,12 @@ socket.on('connect', function() { console.log('Connected to the server'); // Debug log, i'll delete later socket.emit('fetch_daily_stats', serviceId); - socket.emit('fetch_single_month_notification_stats', serviceId); - socket.emit('fetch_monthly_stats_by_year', serviceId); }); //this is for previous 7 days socket.on('daily_stats_update', function(data) { console.log('Received daily_stats_update:', data); - // Process the data + var labels = []; var deliveredData = []; // var failureData = []; @@ -31,23 +29,13 @@ myBarChart.data.datasets[0].data = deliveredData; myBarChart.update(); }); - //this is for a single month - socket.on('single_month_notification_stats_update', function(data) { - console.log('Received single_month_notification_stats_update:', data); - // Update Chart.js with new data here - }); - //this is for monthly stats by year - socket.on('monthly_stats_by_year_update', function(data) { - console.log('Received monthly_stats_by_year_update:', data); - // Update Chart.js with new data here - }); socket.on('error', function(data) { console.log('Error:', data); }); sevenDaysButton.addEventListener('click', function() { - socket.emit('fetch_monthly_stats_by_year', serviceId); + socket.emit('fetch_daily_stats', serviceId); console.log('button click'); // Debug log, i'll delete later }); @@ -56,7 +44,7 @@ var myBarChart = new Chart(ctx, { type: 'bar', data: { - labels: [], // Initialize with empty data + labels: [], datasets: [ { label: 'Delivered',