style: prettier campaign snapshot utilities
This commit is contained in:
parent
f53d5b9dc2
commit
d83314c7b7
2 changed files with 8 additions and 13 deletions
|
|
@ -2,11 +2,16 @@ import 'server-only'
|
|||
|
||||
import type { Payload } from 'payload'
|
||||
|
||||
import type { AccessibleMunicipality } from '@/lib/municipalityProximity'
|
||||
import { isUnrestrictedCampaignRole } from '@/lib/campaignRoles'
|
||||
import type { AccessibleMunicipality } from '@/lib/municipalityProximity'
|
||||
import { relationshipId, requireRelationshipId } from '@/lib/relationship'
|
||||
import type { VoteEstimateScenario } from '@/lib/voteEstimate'
|
||||
import type { CampaignUser, VotePledge } from '@/payload-types'
|
||||
import {
|
||||
loadCampaignHomeSummaryDelta,
|
||||
loadStatewideStaffVoteTotalCentral,
|
||||
recordCampaignVoteSummarySnapshotIfNeeded,
|
||||
} from '@/utilities/campaignVoteSummarySnapshot'
|
||||
import {
|
||||
pickDashboardPriorityMunicipalities,
|
||||
type DashboardPriorityMunicipality,
|
||||
|
|
@ -22,11 +27,6 @@ import {
|
|||
loadStatewideSuggestedGoals,
|
||||
type MunicipalityGoalCoverageBundle,
|
||||
} from '@/utilities/municipality/municipalityGoalAccount'
|
||||
import {
|
||||
loadCampaignHomeSummaryDelta,
|
||||
loadStatewideStaffVoteTotalCentral,
|
||||
recordCampaignVoteSummarySnapshotIfNeeded,
|
||||
} from '@/utilities/campaignVoteSummarySnapshot'
|
||||
import {
|
||||
rollupMunicipalityStaffVotes,
|
||||
type MunicipalityPledgeAggregate,
|
||||
|
|
|
|||
|
|
@ -44,9 +44,7 @@ const pruneOldCampaignVoteSummarySnapshots = async (
|
|||
* Intentional admin bypass: internal aggregate not tied to the requesting actor's
|
||||
* municipality scope — the snapshot is always statewide.
|
||||
*/
|
||||
export const loadStatewideStaffVoteTotalCentral = async (
|
||||
payload: Payload,
|
||||
): Promise<number> => {
|
||||
export const loadStatewideStaffVoteTotalCentral = async (payload: Payload): Promise<number> => {
|
||||
const [municipalities, pledgeAggregates] = await Promise.all([
|
||||
payload
|
||||
.find({
|
||||
|
|
@ -125,10 +123,7 @@ export const loadCampaignHomeSummaryDelta = async (
|
|||
const target = await payload.find({
|
||||
collection: SNAPSHOT_COLLECTION,
|
||||
where: {
|
||||
and: [
|
||||
{ day: { equals: targetDayIso } },
|
||||
{ scopeKey: { equals: SNAPSHOT_SCOPE_STATEWIDE } },
|
||||
],
|
||||
and: [{ day: { equals: targetDayIso } }, { scopeKey: { equals: SNAPSHOT_SCOPE_STATEWIDE } }],
|
||||
},
|
||||
depth: 0,
|
||||
limit: 1,
|
||||
|
|
|
|||
Loading…
Reference in a new issue