Skip to content

Commit

Permalink
tidy logs on metrics tab
Browse files Browse the repository at this point in the history
  • Loading branch information
JGreenlee committed Aug 16, 2024
1 parent 74986bc commit 04d3f85
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
6 changes: 0 additions & 6 deletions www/js/components/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ const Chart = ({
? {}
: {
callback: (value, i) => {
logDebug(`Horizontal axis callback: i = ${i};
chartDatasets = ${JSON.stringify(chartDatasets)};
chartDatasets[0].data = ${JSON.stringify(chartDatasets[0].data)}`);
//account for different data possiblities
const label =
chartDatasets[0].data[i]?.y || chartDatasets[i].data[0]?.y;
Expand Down Expand Up @@ -185,9 +182,6 @@ const Chart = ({
? {}
: {
callback: (value, i) => {
logDebug(`Vertical axis callback: i = ${i};
chartDatasets = ${JSON.stringify(chartDatasets)};
chartDatasets[0].data = ${JSON.stringify(chartDatasets[0].data)}`);
//account for different data possiblities - one mode per week, one mode both weeks, mixed weeks
const label =
chartDatasets[0].data[i]?.x || chartDatasets[i].data[0]?.x;
Expand Down
10 changes: 5 additions & 5 deletions www/js/metrics/CarbonFootprintCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ const CarbonFootprintCard = ({ userMetrics, aggMetrics }: Props) => {
// Issue 422:
// https://github.com/e-mission/e-mission-docs/issues/422
let aggCarbonData: MetricsSummary[] = [];
for (let i in aggThisWeekSummary) {
aggCarbonData.push(aggThisWeekSummary[i]);
if (isNaN(aggCarbonData[i].values)) {
for (let summaryEntry of aggThisWeekSummary) {
aggCarbonData.push(summaryEntry);
if (isNaN(summaryEntry.values)) {
logWarn(`WARNING in calculating groupCarbonRecords: value is NaN for mode
${aggCarbonData[i].key}, changing to 0`);
aggCarbonData[i].values = 0;
${summaryEntry.key}, changing to 0`);
summaryEntry.values = 0;
}
}

Expand Down
10 changes: 5 additions & 5 deletions www/js/metrics/CarbonTextCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ const CarbonTextCard = ({ userMetrics, aggMetrics }: Props) => {
// Issue 422:
// https://github.com/e-mission/e-mission-docs/issues/422
let aggCarbonData: MetricsSummary[] = [];
for (let i in aggThisWeekSummary) {
aggCarbonData.push(aggThisWeekSummary[i]);
if (isNaN(aggCarbonData[i].values)) {
for (let summaryEntry of aggThisWeekSummary) {
aggCarbonData.push(summaryEntry);
if (isNaN(summaryEntry.values)) {
logWarn(`WARNING in calculating groupCarbonRecords: value is NaN for mode
${aggCarbonData[i].key}, changing to 0`);
aggCarbonData[i].values = 0;
${summaryEntry.key}, changing to 0`);
summaryEntry.values = 0;
}
}

Expand Down
1 change: 0 additions & 1 deletion www/js/metrics/MetricsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ async function fetchAggMetrics(
};
return getAggregateData('result/metrics/yyyy_mm_dd', query, appConfig.server)
.then((response) => {
logDebug('MetricsTab: received aggMetrics');
console.debug('MetricsTab: received aggMetrics', response);
return response as MetricsData;
})
Expand Down

0 comments on commit 04d3f85

Please sign in to comment.