Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
AlterTobi committed Nov 4, 2024
1 parent 1e1a9f8 commit 96a5507
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions no_support/wfes-editChallengeCounter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @name Edit Challenge Counter
// @version 1.0.2
// @version 1.0.3
// @description Count Edit Contributions for the 2024 Wayfarer Edit Challenge
// @author AlterTobi

Expand Down Expand Up @@ -45,11 +45,11 @@
});

// Zählprozess
const startDate = new Date(START_DATE);
const endDate = new Date(END_DATE);
contributions.forEach(item => {
// Vergleiche Datum und Typ des Objekts
const itemDate = new Date(item.day);
const startDate = new Date(START_DATE);
const endDate = new Date(END_DATE);

if (itemDate >= startDate && itemDate <= endDate && TYPES.includes(item.type)) {
counts[item.type]++;
Expand Down Expand Up @@ -96,7 +96,10 @@
const contributions = window.wfes.g.nominationsList();

const result = countContributions(contributions);
const resultSum = result.PHOTO + result.EDIT_TITLE + result.EDIT_DESCRIPTION + result.EDIT_LOCATION;
let resultSum = 0;
TYPES.forEach(type => {
resultSum += result[type];
});
const resulttext = " (P" + result.PHOTO + " T" + result.EDIT_TITLE +
" D" + result.EDIT_DESCRIPTION + " L" + result.EDIT_LOCATION + ")";

Expand Down

0 comments on commit 96a5507

Please sign in to comment.