Repository navigation
fix(analytics): attribute applications to original applied date instead of status update date - #104
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ad of status update date
SagiEv
force-pushed
the
fix/analytics-monthly-volume-applied-date
branch
from
November 29, 2026 12:11
4a3327e to
8a3aed3
Compare
…cation_history queries
This branch was successfully deployed
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.
Problem
Updating an older application's status (e.g., marking a ghosted application as
Ignored) caused it to be counted as a newly applied application in the current month on the Monthly Volume chart and in the This Week / This Month KPI cards.Root Cause
applications.service.js(updateApplication) overwroteapplications.datewithlatestEvent.event_dateon every status/stage update.calculateMonthlyVolumeandAnalyticsPage) grouped applied counts byapp.DATE, shifting previously applied jobs into the month of their latest status update.Changes
Backend (Node.js)
backend/services/applications.service.jsupdateData.dateoverwrite inupdateApplication()so status/stage updates preserve the originalapplications.date(whilelast_activity_datecontinues tracking the latest history event).getAllApplications()to deriveapplied_date(YYYY-MM-DD) from already-fetchedapplication_historyrows (no extra DB query): prefers the earliest'Application Added'event, falls back to the earliest valid date across history/app.date/app.created_atfor legacy rows without'Application Added', and finallyapp.date || app.created_at.Frontend (React)
frontend/src/queries/queryDefinitions.jsAPPLIED_DATE: row.applied_date || row.date || ''infromDbApplication().frontend/src/utils/analyticsCalculations.jscalculateMonthlyVolume()to bucket "Applications Applied" byAPPLIED_DATE || applied_date || DATE || date.frontend/src/pages/AnalyticsPage.jsxthisWeek,thisMonth, andlastMonthKPI calculations to useAPPLIED_DATE || DATEfor consistency with Monthly Volume.Database / Legacy Data
supabase/migrations/20261129000000_backfill_applications_date.sqlapplications.datefromapplication_history(Application Addedfirst, else earliestevent_date) only whenapplications.dateisNULLor later than the earliest recorded history date.applied_dateeven prior to running the migration.Testing
npm test): 53/53 suites, 426/426 tests passed.backend/tests/applications.status.test.js(verifiesIgnoredstatus update does not overwritedate) andbackend/tests/services/applications.service.test.js(verifiesapplied_datederivation for both standard and legacy rows).npx vitest run src/utils/__tests__/analyticsCalculations.test.js): 22/22 tests passed.Ignoredapplications are counted in their originalAPPLIED_DATEmonth rather than the status update month.2026-11-01.