-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add submission completedAt column #2951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdds a nullable completedAt timestamp to BountySubmission (schema, Zod, Prisma), writes completedAt when submissions are finalized/submitted, updates APIs to backfill and filter counts by submitted/approved, and adjusts UI to use completedAt/reviewedAt for status labels and displayed dates. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant UI
participant API
participant DB
User->>UI: Finalize submission (isDraft=false)
UI->>API: POST /create-bounty-submission { isDraft:false, ... }
API->>DB: upsert BountySubmission { ..., completedAt: now }
DB-->>API: saved submission
API-->>UI: return submission
UI-->>User: show status/date using completedAt/reviewedAt
Note over UI,API: Workflow path
UI->>API: POST /execute-complete-bounty-workflow
API->>DB: update BountySubmission { status: submitted, completedAt: now }
DB-->>API: updated
API-->>UI: ack
UI-->>User: reflect Completed / Confirmed labels and dates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx(2 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx(1 hunks)apps/web/lib/actions/partners/create-bounty-submission.ts(2 hunks)apps/web/lib/api/workflows/execute-complete-bounty-workflow.ts(1 hunks)apps/web/lib/zod/schemas/bounties.ts(1 hunks)apps/web/ui/partners/bounties/claim-bounty-modal.tsx(1 hunks)packages/prisma/schema/bounty.prisma(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (7)
apps/web/lib/api/workflows/execute-complete-bounty-workflow.ts (1)
173-173: LGTM!The completedAt timestamp is correctly set when marking the submission as submitted. The early return check (lines 95-101) ensures this only executes once per submission, preventing duplicate timestamp updates.
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx (1)
205-209: LGTM! This fixes a semantic inconsistency.The "Completed" column now correctly displays the completion date (completedAt) rather than the commission creation date. This is semantically correct for performance bounties where completion (meeting criteria) precedes approval (commission creation). The null check ensures graceful handling of legacy submissions without completedAt.
apps/web/lib/zod/schemas/bounties.ts (1)
127-127: LGTM!The schema addition is correct. The nullable type appropriately handles both draft submissions (which don't have a completion date) and legacy submissions (created before this field existed).
apps/web/lib/actions/partners/create-bounty-submission.ts (1)
160-160: LGTM!The completedAt timestamp is correctly set only for non-draft submissions, ensuring that both the create and update paths capture the finalization moment. This correctly distinguishes between record creation (createdAt) and submission finalization (completedAt).
packages/prisma/schema/bounty.prisma (1)
79-79: LGTM!The schema addition is correct. The optional DateTime type appropriately handles draft submissions and ensures backward compatibility with existing records, which will have NULL values for this field.
apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx (1)
149-152: LGTM!The "Confirmed" label with reviewedAt correctly represents the approval timestamp for the default status path.
apps/web/ui/partners/bounties/claim-bounty-modal.tsx (1)
350-357: LGTM!The "Confirmed" label with reviewedAt correctly represents the approval timestamp for approved submissions.
...rtners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx
Outdated
Show resolved
Hide resolved
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
apps/web/app/(ee)/api/bounties/route.ts(1 hunks)apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx(2 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx(2 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsx(3 hunks)apps/web/scripts/migrations/backfill-submission-completedat.ts(1 hunks)apps/web/ui/partners/bounties/claim-bounty-modal.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-25T17:39:38.965Z
Learnt from: devkiran
PR: dubinc/dub#2736
File: apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx:45-56
Timestamp: 2025-08-25T17:39:38.965Z
Learning: In the bounty system, each partner can only submit to the same bounty once. This means totalSubmissions (pending + approved + rejected) equals the number of unique partners who have submitted, making UI text like "X of Y partners completed" accurate when using totalSubmissions.
Applied to files:
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/prisma/schema/bounty.prisma (1)
79-79: Consider adding an index on completedAt for query performance.If you plan to filter or sort submissions by
completedAt(e.g., in analytics or reporting queries), consider adding an index to improve performance.Example:
completedAt DateTime? + + @@index(completedAt)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
apps/web/app/(ee)/api/bounties/route.ts(1 hunks)apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx(2 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx(2 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx(1 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsx(3 hunks)apps/web/lib/actions/partners/create-bounty-submission.ts(2 hunks)apps/web/lib/api/workflows/execute-complete-bounty-workflow.ts(1 hunks)apps/web/lib/zod/schemas/bounties.ts(1 hunks)apps/web/scripts/migrations/backfill-submission-completedat.ts(1 hunks)apps/web/ui/partners/bounties/claim-bounty-modal.tsx(1 hunks)packages/prisma/schema/bounty.prisma(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-25T17:39:38.965Z
Learnt from: devkiran
PR: dubinc/dub#2736
File: apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx:45-56
Timestamp: 2025-08-25T17:39:38.965Z
Learning: In the bounty system, each partner can only submit to the same bounty once. This means totalSubmissions (pending + approved + rejected) equals the number of unique partners who have submitted, making UI text like "X of Y partners completed" accurate when using totalSubmissions.
Applied to files:
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (14)
apps/web/lib/api/workflows/execute-complete-bounty-workflow.ts (1)
166-178: LGTM!The addition of
completedAt: new Date()when transitioning from draft to submitted status is correct and consistent with the schema changes.apps/web/lib/actions/partners/create-bounty-submission.ts (2)
149-163: LGTM!The conditional addition of
completedAtfor non-draft submissions in the update path is correct.
165-179: LGTM!The conditional addition of
completedAtfor non-draft submissions in the create path is correct and consistent with the update path.apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx (2)
24-28: LGTM!Filtering to only count "submitted" and "approved" submissions aligns with the API changes and provides more accurate counts for completed bounties.
81-82: LGTM!The type-specific text ("completed" for performance, "submitted" for others) provides clearer messaging to users.
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsx (3)
55-57: LGTM!The conditional rendering of the ended badge when
endsAtis in the past is correct and provides good visual feedback.
111-119: LGTM!The
BountyEndedBadgecomponent is clean and well-positioned. The styling is consistent with the codebase.
101-102: LGTM!The type-specific text matches the changes in
bounty-info.tsxand provides consistent messaging.apps/web/scripts/migrations/backfill-submission-completedat.ts (1)
6-12: Limit scope to ACME program or adjust filterThe migration currently only targets ACME_PROGRAM_ID. Verify whether submissions in other programs also need backfilling (e.g., query all programIds where status in ["submitted","approved"] and completedAt is null). If they do, remove or parameterize the programId filter; otherwise, document this limitation.
apps/web/app/(ee)/api/bounties/route.ts (1)
76-83: Verify no clients rely on total submissions count
This change filterssubmissionsCountto only"submitted"and"approved", altering the API response shape. Confirm that no other integrations, SDKs, mobile apps, or webhooks consume this endpoint expecting the previous total‐count behavior.apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx (1)
199-213: completedAt is set for all completed submissions
create-bounty-submission (non-draft), execute-complete-bounty-workflow, and backfill migration assigncompletedAt.apps/web/lib/zod/schemas/bounties.ts (1)
127-127: LGTM!The completedAt field is correctly added to the schema with an appropriate nullable date type, consistent with other timestamp fields like reviewedAt.
apps/web/ui/partners/bounties/claim-bounty-modal.tsx (1)
339-355: LGTM! Past review comment addressed.The status badge rendering now correctly uses
completedAtfor submitted bounties andreviewedAtfor approved bounties, resolving the previous issue wherecreatedAtwas incorrectly used. The conditional rendering appropriately handles nullable dates.apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx (1)
122-141: LGTM! Past review comment addressed.The status badge rendering now correctly uses
completedAtfor submitted bounties (lines 123-124) andreviewedAtfor approved bounties (lines 140-141), resolving the previous issue wherecreatedAtwas incorrectly used. The implementation is consistent with the claim-bounty-modal.tsx file.
Summary by CodeRabbit
New Features
Bug Fixes
Chores