Theme: Off-day logic, notification boundaries, and why silence is sometimes golden
Mood: A delicate mix of rage, irony, and passive-aggressive refactoring
This is where its begin: Building a Web-Based Clocking System: A 48-Hour Sprint (and a Latte or Two)
☕️ Prologue: When WhatsApp Became a Digital Drill Sergeant
Saturday morning. Your employee Bob is dreaming about nasi lemak and not being productive. His bed is warm. The air is peaceful. Birds are chirping in slow motion. Life is good.
Suddenly…
BUZZ! BUZZ!
“You’re late for work!”
Bob: “Work?! It’s my off day! I’m in boxers and Netflix mode!”
Meanwhile, the admin gets hit too:
“Bob didn’t clock in! Sound the alarm! Panic!”
The admin, confused and still on their first sip of coffee, opens the schedule and mutters: “But I marked Bob as OFF today…”
And that, friends, is how I discovered our notification system was in its villain arc.
🕵️ Act I: The Investigation – Notifications Gone Wild
The culprit? A notification system that doesn’t know the meaning of “boundaries.”
It was like a clingy ex—popping up uninvited, at the worst times, with emotionally charged accusations.
// The Problematic Code
async handleLateClockInNotifications(...) {
...
// No check for off-day!
// This thing was like: “I don’t care if it’s your birthday. You’re LATE.”
}
Our notification system didn’t just forget off-days. It refused to acknowledge them. Full-on denial. Like a bug-powered workaholic who believes weekends are a capitalist illusion.
🤹♂️ Act II: Meet the Split Personality System
It turns out our notification logic had multiple identities, each with its own annoying habit.
👮♂️ Personality #1: “The Late Police”
-
Behavior: Sends “you’re late!” messages even on off-days.
-
Favorite phrase: “Time is money, Bob! Sleep is for the weak!”
-
Status: Emotionally unavailable. Spiritually chaotic.
🕵️♀️ Personality #2: “The Attendance Stalker”
-
Behavior: Alerts admins when someone doesn’t show up—even if they were never scheduled.
-
Motto: “Everyone is guilty until proven on-shift.”
-
Fun Fact: Has serious trust issues with the calendar.
🔧 Act III: The Fix – Teaching Notifications About Boundaries
👨⚕️ Surgery #1: Clock-In Respect Therapy
I gently reminded the system that maybe, just maybe, it should check the schedule before throwing tantrums.
// Before:
if (latenessInfo.isLate) {
// "LATE!!!" – regardless of schedule
}
// After:
if (scheduleResult.length > 0 && scheduleResult[0].is_off_day) {
console.log(`User ${userData.full_name} is off today – skipping nagging.`);
return;
}
Translation: If they’re off, let them be off. Go journal about it instead.
🧠 Surgery #2: Stalker Detox
I rewrote the SQL query to stop calling out people who weren’t even supposed to show up. Groundbreaking idea, really.
-- Before:
WHERE es.is_off_day = 0
-- After:
WHERE es.schedule_date = ? AND es.is_off_day = 0 AND s.start_time IS NOT NULL
This taught the system the difference between a no-show and a no-schedule. Baby steps.
💆 Act IV: Post-Op Recovery – Group Therapy for Code
I wrapped it up with some wholesome logging and sanity-preserving logic:
if (user.is_off_day) {
console.log(`Skipping notification for ${user.full_name} – it's their day off.`);
continue;
}
Now the system respects boundaries.
It doesn’t panic when Bob sleeps in on Saturdays. It doesn’t accuse HR of ghosting. It finally discovered… inner peace. 🧘
🧪 Act V: Results – The Great Notification Awakening
💤 Test Case 1: Bob’s Weekend Zen
Before | After |
---|---|
6:00 AM WhatsApp alert | Peaceful silence |
Bob’s stress level: 💀 | Bob’s sleep: 😴 |
Bob’s wife: 😡 | Bob’s wife: 😊 |
✅ Marriage saved.
✅ No HR complaints.
✅ One fewer employee plotting revenge.
🧘♀️ Test Case 2: Admin Stress Reduction Program
Before | After |
---|---|
“6 employees didn’t show up!” | “1 real issue – valid concern” |
Admin anxiety: 🔥🔥🔥 | Admin coffee break: ☕ |
🧰 Technical Breakdown: For Devs Who Dream in SQL
Files Updated:
/server/services/notificationHelper.js
├── handleLateClockInNotifications()
│ ├── Schedule-aware notification logic
└── handleNoClockInNotifications()
├── Smarter SQL
└── Logic filters based on real shift data
Total Impact:
-
🧠 Smarter logic
-
💻 Zero frontend changes
-
🗃️ No DB schema changes
-
🧘 Developer sanity preserved
📚 Moral of the Story: Sometimes the Best Feature is Doing Nothing
Let’s face it—developers love to build things that do things. But sometimes, not doing something is a superpower.
Here’s what I taught our system:
-
✅ Silence is golden – especially before 9 AM
-
✅ Check your facts before calling someone out
-
✅ Off-days mean off
-
✅ Your code needs boundaries too
🐾 Epilogue: Bob’s Revenge
Bob is now back at work. Calm. Happy. Unbothered.
His WhatsApp? Quiet.
His alarm clock? Still set to “Never on weekends.”
His respect for the dev team? Fully restored.
And the notification system? It’s in therapy. But it’s getting better.
⚠️ Coming Up Next…
Can our system learn not to notify someone who just clocked out five seconds ago?
Will it finally distinguish between “forgot to clock in” and “stuck in traffic during a thunderstorm with no WiFi?”
Will it stop sending reminders to people on medical leave?
Stay tuned. We’re not just debugging code—we’re debugging life.
Zabel Iqbal
Developer. Debugger. Defender of weekends. Friend of Bob. 🕶️
“Remember: Even machines need to learn boundaries.” – Zabel, probably while fixing a bug at 2am