Closed sebastianserrano closed 2 years ago
User a more modular approach for:
https://github.com/alltrust/Reminder-App/blob/628a2d8c14e37277dc36ce95243ad413ef014cd7/src/components/LegendForReminders/LegendReminders.js#L23
const isLowPriority = (reminder) => reminder.priority === "low" || reminder.priority === "" const isMidPriority = (reminder) => reminder.priority === "medium" const isHighPriority = (reminder) => reminder.priority === "high" const isReminderCompleted = (reminder) => reminder.completionStatus === false const lowPriorities = reminderData.map((reminder) => isLowPriority(reminder) && isReminderCompleted(reminder)) const moderatePriorities = reminderData.map((reminder) => isMidPriority(reminder) && isReminderCompleted(reminder)) const highPriorities = reminderData.map((reminder) => isHighPriority(reminder) && isReminderCompleted(reminder))
done
completionStatus
false
completed
boolean
isCompleted
The reminder is said to be done when the completionStatus is true.
Check my other comment regarding completionStatus.
Also, you can refactor what I wrote even further to have fewer lines
User a more modular approach for:
https://github.com/alltrust/Reminder-App/blob/628a2d8c14e37277dc36ce95243ad413ef014cd7/src/components/LegendForReminders/LegendReminders.js#L23
Notes
done
when thecompletionStatus
isfalse
? Thats a bit confusing if thats correct. Why not something more descriptive likecompleted
. If you want to use aboolean
then rename it to something likeisCompleted