style: prettier campaign snapshot utilities

This commit is contained in:
Cursor Agent 2026-08-01 06:34:25 +00:00
parent f53d5b9dc2
commit d83314c7b7
No known key found for this signature in database
2 changed files with 8 additions and 13 deletions

View file

@ -2,11 +2,16 @@ import 'server-only'
import type { Payload } from 'payload' import type { Payload } from 'payload'
import type { AccessibleMunicipality } from '@/lib/municipalityProximity'
import { isUnrestrictedCampaignRole } from '@/lib/campaignRoles' import { isUnrestrictedCampaignRole } from '@/lib/campaignRoles'
import type { AccessibleMunicipality } from '@/lib/municipalityProximity'
import { relationshipId, requireRelationshipId } from '@/lib/relationship' import { relationshipId, requireRelationshipId } from '@/lib/relationship'
import type { VoteEstimateScenario } from '@/lib/voteEstimate' import type { VoteEstimateScenario } from '@/lib/voteEstimate'
import type { CampaignUser, VotePledge } from '@/payload-types' import type { CampaignUser, VotePledge } from '@/payload-types'
import {
loadCampaignHomeSummaryDelta,
loadStatewideStaffVoteTotalCentral,
recordCampaignVoteSummarySnapshotIfNeeded,
} from '@/utilities/campaignVoteSummarySnapshot'
import { import {
pickDashboardPriorityMunicipalities, pickDashboardPriorityMunicipalities,
type DashboardPriorityMunicipality, type DashboardPriorityMunicipality,
@ -22,11 +27,6 @@ import {
loadStatewideSuggestedGoals, loadStatewideSuggestedGoals,
type MunicipalityGoalCoverageBundle, type MunicipalityGoalCoverageBundle,
} from '@/utilities/municipality/municipalityGoalAccount' } from '@/utilities/municipality/municipalityGoalAccount'
import {
loadCampaignHomeSummaryDelta,
loadStatewideStaffVoteTotalCentral,
recordCampaignVoteSummarySnapshotIfNeeded,
} from '@/utilities/campaignVoteSummarySnapshot'
import { import {
rollupMunicipalityStaffVotes, rollupMunicipalityStaffVotes,
type MunicipalityPledgeAggregate, type MunicipalityPledgeAggregate,

View file

@ -44,9 +44,7 @@ const pruneOldCampaignVoteSummarySnapshots = async (
* Intentional admin bypass: internal aggregate not tied to the requesting actor's * Intentional admin bypass: internal aggregate not tied to the requesting actor's
* municipality scope — the snapshot is always statewide. * municipality scope — the snapshot is always statewide.
*/ */
export const loadStatewideStaffVoteTotalCentral = async ( export const loadStatewideStaffVoteTotalCentral = async (payload: Payload): Promise<number> => {
payload: Payload,
): Promise<number> => {
const [municipalities, pledgeAggregates] = await Promise.all([ const [municipalities, pledgeAggregates] = await Promise.all([
payload payload
.find({ .find({
@ -125,10 +123,7 @@ export const loadCampaignHomeSummaryDelta = async (
const target = await payload.find({ const target = await payload.find({
collection: SNAPSHOT_COLLECTION, collection: SNAPSHOT_COLLECTION,
where: { where: {
and: [ and: [{ day: { equals: targetDayIso } }, { scopeKey: { equals: SNAPSHOT_SCOPE_STATEWIDE } }],
{ day: { equals: targetDayIso } },
{ scopeKey: { equals: SNAPSHOT_SCOPE_STATEWIDE } },
],
}, },
depth: 0, depth: 0,
limit: 1, limit: 1,