Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/helpers/userHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const userHelper = function () {
.localeData()
.ordinal(totalInfringements)}</b> blue square of 5.</p>`;
} else {
let hrThisweek = weeklycommittedHours || 0 + coreTeamExtraHour;
let hrThisweek = weeklycommittedHours || 0;
const remainHr = timeRemaining || 0;
hrThisweek += remainHr;
finalParagraph = `Please complete ALL owed time this week (${
Expand Down Expand Up @@ -552,9 +552,6 @@ const userHelper = function () {
);

const { timeSpent_hrs: timeSpent } = results[0];
const weeklycommittedHours = user.weeklycommittedHours + (user.missedHours ?? 0);
const timeNotMet = timeSpent < weeklycommittedHours;
const timeRemaining = weeklycommittedHours - timeSpent;

let isNewUser = false;
const userStartDate = moment.tz(
Expand Down Expand Up @@ -699,6 +696,12 @@ const userHelper = function () {
// No extra hours is needed if blue squares isn't over 5.
// length +1 is because new infringement hasn't been created at this stage.
const coreTeamExtraHour = Math.max(0, oldInfringements.length + 1 - 5);
const weeklycommittedHours =
user.weeklycommittedHours +
(user.missedHours ?? 0) +
(person.role === 'Core Team' ? coreTeamExtraHour : 0);
const timeNotMet = timeSpent < weeklycommittedHours;
const timeRemaining = Math.max(weeklycommittedHours - timeSpent, 0);
const utcStartMoment = moment(pdtStartOfLastWeek).add(1, 'second');
const utcEndMoment = moment(pdtEndOfLastWeek)
.subtract(1, 'day')
Expand Down Expand Up @@ -749,7 +752,7 @@ const userHelper = function () {
.localeData()
.ordinal(
oldInfringements.length + 1,
)} blue square. So you should have completed ${weeklycommittedHours + coreTeamExtraHour} hours and you completed ${timeSpent.toFixed(
)} blue square. So you should have completed ${weeklycommittedHours} hours and you completed ${timeSpent.toFixed(
2,
)} hours.`;
} else {
Expand All @@ -773,7 +776,7 @@ const userHelper = function () {
.localeData()
.ordinal(
oldInfringements.length + 1,
)} blue square. So you should have completed ${weeklycommittedHours + coreTeamExtraHour} hours and you completed ${timeSpent.toFixed(
)} blue square. So you should have completed ${weeklycommittedHours} hours and you completed ${timeSpent.toFixed(
2,
)} hours.`;
} else {
Expand Down