Skip to content

Commit

Permalink
fixing single day label check for current week
Browse files Browse the repository at this point in the history
  • Loading branch information
Ortega-Dan committed Oct 16, 2023
1 parent f44c02f commit 1efc76d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
37 changes: 19 additions & 18 deletions src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function showHoursDiffTo(hoursSum, hoursThreshold, label, isRealHoursReport, dis
alert("[" + label + "]\n\n" + (isRealHoursReport ? "You've worked " : "You have ") +
convertDecimalHoursToTimeFormat((hoursThreshold - hoursSum) * -1) + " extra hours")
} else if ((hoursThreshold - hoursSum) == 0) {
alert("[" + label + "]\n\nYou're done for " + (label.toLowerCase().includes("week") ? "the week" : "the day") + "!")
alert("[" + label + "]\n\nYou're done for " + (label.toLowerCase().includes("week") ? "the week" : "the day") + (label.toLowerCase().includes("so far") ? " so far" : "") + "!")
} else {
let timeDiffString = convertDecimalHoursToTimeFormat(hoursThreshold - hoursSum)

Expand Down Expand Up @@ -230,25 +230,26 @@ function hoursCountingFlow(event) {
}

// Showing results
if (calendarTimeAdder === 0) {
alert("No active events found for filter [" + requiredDayText + "]")
// alert("No events owned, confirmed, or pending confirmation found for filter [" + requiredDayText + "]")
// if (calendarTimeAdder === 0) {
// alert("No active events found for filter [" + requiredDayText + "]")
// // alert("No events owned, confirmed, or pending confirmation found for filter [" + requiredDayText + "]")
// }

// Showing results
alert("[" + requiredDayText + (isPartialWeekReport && requiredDayText == "Entire Week" ? " So Far" : "") + "]\n\n" +
convertDecimalHoursToTimeFormat(isRealHoursReport ? passedHoursAdder : calendarTimeAdder) +
" hours " + (isRealHoursReport ? "worked" : "recorded"))

if (requiredDayText == "Entire Week") {
// show hours diff for week query
showHoursDiffTo(isRealHoursReport ? passedHoursAdder : calendarTimeAdder, weeklyHoursMargin, requiredDayText + (isPartialWeekReport ? " So Far" : "")
, isRealHoursReport, isPartialWeekReport)
} else {
alert("[" + requiredDayText + (isPartialWeekReport ? " So Far" : "") + "]\n\n" +
convertDecimalHoursToTimeFormat(isRealHoursReport ? passedHoursAdder : calendarTimeAdder) +
" hours " + (isRealHoursReport ? "worked" : "recorded"))

if (requiredDayText == "Entire Week") {
// show hours diff for week query
showHoursDiffTo(isRealHoursReport ? passedHoursAdder : calendarTimeAdder, weeklyHoursMargin, requiredDayText + (isPartialWeekReport ? " So Far" : "")
, isRealHoursReport, isPartialWeekReport)
// Show hours diff for single day query
if (isRealHoursReport) {
showHoursDiffTo(passedHoursAdder, DAILY_HOURS_MARGIN, requiredDayText, isRealHoursReport, (isRealHoursReport && isCurrentDayReport))
} else {
// Show hours diff for single day query
if (isRealHoursReport) {
showHoursDiffTo(passedHoursAdder, DAILY_HOURS_MARGIN, requiredDayText, isRealHoursReport, (isRealHoursReport && isCurrentDayReport))
} else {
showHoursDiffTo(calendarTimeAdder, DAILY_HOURS_MARGIN, requiredDayText, isRealHoursReport, false)
}
showHoursDiffTo(calendarTimeAdder, DAILY_HOURS_MARGIN, requiredDayText, isRealHoursReport, false)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Calendar Hours Counter",
"description": "(For Google Calendar configured with English (US) language)",
"version": "2.0.0",
"version": "2.2.2",
"icons": {
"16": "calendar16.png",
"48": "calendar48.png",
Expand Down

0 comments on commit 1efc76d

Please sign in to comment.