Skip to content

Commit

Permalink
Fix type breakdown when some colors have no cards.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruler501 committed Jan 6, 2020
1 parent ec219a9 commit d41c21f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions public/js/analytics/typeBreakdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ onmessage = (e) => {
for (let color of Object.keys(TypeByColor['Total'])) {
if (color == 'key') continue;
const total = TypeByColor['Total'][color];
if (color == 'key' || total == 0) continue;
for (let type in TypeByColor) {
console.log(`${type} - ${color}`);
if (type == 'Total') continue;
const count = TypeByColor[type][color];
var percentage;
const percentage = Math.round((100.0 * count) / total);
TypeByColor[type][color] = `${count} %25${percentage}%25`;
console.log(TypeByColor[type][color]);
Expand Down
3 changes: 1 addition & 2 deletions public/js/analytics/typeBreakdownAsfan.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,8 @@ onmessage = (e) => {

for (let color of Object.keys(TypeByColor['Total'])) {
const total = TypeByColor['Total'][color];
if (color == 'key') continue;
if (color == 'key' || total == 0) continue;
for (let type in TypeByColor) {
console.log(`${type} - ${color}`);
const count = TypeByColor[type][color];
const percentage = Math.round((100.0 * count) / total);
TypeByColor[type][color] = `${count.toFixed(2)} %25${percentage}%25`;
Expand Down

0 comments on commit d41c21f

Please sign in to comment.