Skip to content

Commit d5d0c74

Browse files
authored
Remove links if there are too many tasks (#34)
* Remove links if there are too many tasks * linting fix * remove links from biweekly reminder and filter out icebox
1 parent a1f4a8a commit d5d0c74

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/reminders/messages/completeTaskReportMessage.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export const completeTaskReportMessage = async ({
2020
!hasUrgent && hasUpcoming && !hasUnassigned
2121
? "Nothing urgent or unassigned upcoming! 🐀🥂"
2222
: "Check out all upcoming tasks [here.](https://github.com/orgs/CarletonComputerScienceSociety/projects/18) 🐀🐀";
23+
const urgentItemsLinkThreshold = 5;
24+
const urgentItemsLinkBool = urgentItems.length <= urgentItemsLinkThreshold;
2325

2426
return {
2527
title: "Biweekly Tasks Reminder ☀️🌱",
@@ -30,7 +32,7 @@ export const completeTaskReportMessage = async ({
3032
{
3133
title: "🔥 Urgent & Overdue",
3234
items: urgentItems,
33-
includeLinks: true,
35+
includeLinks: urgentItemsLinkBool,
3436
},
3537
]
3638
: []),

src/reminders/messages/simpleTaskReportMessage.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export const simpleTaskReportMessage = async ({
2323
!hasUrgent && !hasUnassigned
2424
? "Nothing urgent or unassigned today! 🐀🥂"
2525
: "Check out all upcoming tasks [here.](https://github.com/orgs/CarletonComputerScienceSociety/projects/18) 👀";
26-
26+
const urgentItemsLinkThreshold = 5;
27+
const urgentItemsLinkBool = urgentItems.length <= urgentItemsLinkThreshold;
2728
return {
2829
title: `Daily Task Reminder ${randomEmoji}`,
2930
message: `${baseMessage}\n\n💡 **Fun Fact**: ${randomFact}.`,
@@ -33,7 +34,7 @@ export const simpleTaskReportMessage = async ({
3334
{
3435
title: "🔥 Urgent & Overdue",
3536
items: urgentItems,
36-
includeLinks: true,
37+
includeLinks: urgentItemsLinkBool,
3738
},
3839
]
3940
: []),

src/reminders/tasks/dailyTasksReminder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export const dailyTasksReminder = async () => {
3131
if (githubItemsResult.err) {
3232
return githubItemsResult;
3333
}
34-
35-
const nonBacklogItems = filterOutStatus(githubItemsResult.val, "Backlog");
34+
const nonIceboxItems = filterOutStatus(githubItemsResult.val, "Icebox");
35+
const nonBacklogItems = filterOutStatus(nonIceboxItems, "Backlog");
3636
const unassignedItems = filterForUnassigned(nonBacklogItems);
3737
const upcomingItems = filterUpcomingItems(nonBacklogItems);
3838
const urgentItems = filterForUrgentItems(nonBacklogItems);

0 commit comments

Comments
 (0)