RealDevSquad / RealDevSquad/website-backend
Bug: OOO Status Not Automatically Expired When No FutureStatus is Set
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 74
- Forks
- 276
- Avg merge
- 1d 26m
- Merged PRs (30d)
- 14
Description
Problem Description
The updateAllUserStatus() function does not automatically remove expired OOO (Out of Office) status when a user only has currentStatus set to OOO without a corresponding futureStatus.
Current Behavior
When a user sets their status to OOO directly (via PATCH /users/status/self), the system:
- Sets
currentStatus.state = "OOO"withfromanduntildates - Sets
futureStatus = {}(empty object)
When the OOO period expires (current date > until date):
- The
updateAllUserStatus()cron job does not process these users - The expired OOO status remains in the system
- User continues to show as OOO even after the period has ended
Expected Behavior
When an OOO period expires:
- The system should automatically transition the user to ACTIVE or IDLE status
- The expired OOO status should be removed
- This should happen automatically via the cron job, not requiring manual intervention
Root Cause
The updateAllUserStatus() function in models/userStatus.js only queries users with a futureStatus:
const userStatusDocs = await userStatusModel
.where("futureStatus.state", "in", ["ACTIVE", "IDLE", "OOO"])
.get();
This means users with:
currentStatus.state = "OOO"(expired)futureStatus = {}(empty)
Are not included in the query and therefore never processed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in models/userStatus.js at updateAllUserStatus() and trace the PATCH /users/status/self flow that creates a currentStatus OOO with an empty futureStatus. Check how the cron query selects statuses and how expired statuses transition to ACTIVE or IDLE. Done means current-only OOO records are processed after their until date and the behavior is covered by the relevant status tests, if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100