fix: solve all assignment bugs and add new features - #338
Open
anurag-chandra9 wants to merge 1 commit into
Open
Conversation
## Bug Fixes
### 1. Atomic Task Claiming (Race Condition)
- Replaced two-step read-then-write with a single atomic findOneAndUpdate
- Status filter acts as a guard — only one concurrent request can succeed
- Second claimant now receives a clean 400 'Task is no longer available'
### 2. Submission Versioning (Data Loss on Re-submit)
- Added version (integer) and isLatest (boolean) fields to Submission model
- Re-submissions no longer overwrite — each attempt is a new document
- Previous versions flipped to isLatest: false, preserved forever
- re-submission resets reviewStatus to Pending for admin re-review
- Added compound index { taskId, talentId, version } for query performance
- reviewStatus locked to enum ['Pending', 'Approved', 'Rejected']
### 3. Cascade Delete (Orphaned Submissions)
- deleteTask now calls Submission.deleteMany({ taskId }) before removing task
- All submission versions for a task are cleaned up in the same request
## New Features
### 4. Submission History Timeline (Talent View)
- New GET /api/submissions/my/history endpoint
- New /talent/history page with grouped timeline per task
- Each task thread shows all versions with status badges, file links, notes
- Stat cards: Tasks Submitted / Approved / Rejected / Pending
- Fixed broken 'My Tasks' sidebar link — now points to /talent/history
### 5. Admin Split-Pane Submissions Review
- Replaced basic data table with full-viewport split-pane layout
- Left pane: scrollable card list with search + status tabs (All/Pending/Approved/Rejected)
- Right pane: sticky detail view with task info, talent info, notes, file link
- Inline Approve/Reject buttons with optimistic UI — instant badge update
- Keyboard navigation: left/right arrow keys cycle through submissions
- No more modal — review happens entirely inline
### 6. Form Loading States
- Login, Register, SubmitTaskModal all show spinner + disabled state during requests
- SubmitTaskModal also shows skeleton while prefetching prior submission
- Cancel/close buttons disabled while submission is in flight
### 7. Pre-React HTML Loader
- Added native HTML/CSS loader in index.html — visible before JS bundle loads
- Eliminates white/blank screen on slow connections (Slow 4G / 3G)
- MutationObserver removes loader once React mounts with a fade-out transition
- Animated: pulsing logo, sliding progress bar, bouncing dots
### 8. Remove Assign-To from Create Task
- Removed talent assignment dropdown from CreateTaskModal
- Tasks now always start as Open and are visible to all talents
- Talents claim tasks themselves — supports the race condition fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fixes
1. Atomic Task Claiming (Race Condition)
2. Submission Versioning (Data Loss on Re-submit)
3. Cascade Delete (Orphaned Submissions)
New Features
4. Submission History Timeline (Talent View)
5. Admin Split-Pane Submissions Review
6. Form Loading States
7. Pre-React HTML Loader
8. Remove Assign-To from Create Task
Summary (max 3 sentences)
Checklist
cd client && npm run lint && npm run buildandcd server && npm run lint && npm run buildlocallyShort Demo Video (required)
Required Checklist
Task & Workflow
27-26-22-7-5-pranav-test)master) was pulled immediately before opening this PRQuality & Safety
Checklist Completion Rule
The checklist must be completed after the Pull Request is opened.
Process:
Incomplete or incorrect checklists will result in the PR being closed.