The Open Source kanban (built with Meteor). Keep variable/table/field names camelCase. For translations, only add Pull Request changes to wekan/i18n/en.i18n.json , other translations are done at https://transifex.com/wekan/wekan only.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
wekan/server/lib/dueDateEdits.js

21 lines
869 B

// Pure helpers for counting due-date changes (issue #6081).
//
// WeKan records a due-date change as an Activity with
// `activityType === 'a-dueAt'` (see server/models/cards.js before.update hook).
// Counting those activities for a card gives the number of times the due date
// was set or changed, which lets a Scrum Master see deadline movement without
// being able to quietly move it.
export const DUE_DATE_ACTIVITY_TYPE = 'a-dueAt';
// Count how many of the given activities represent a due-date change.
// `activities` is expected to be an array of activity documents (or any
// array-like with a `.filter`); anything falsy yields 0.
export function countDueDateChanges(activities) {
if (!Array.isArray(activities)) {
return 0;
}
return activities.filter(
activity => activity && activity.activityType === DUE_DATE_ACTIVITY_TYPE,
).length;
}