Skip to content

Commit

Permalink
Fix engagement/pnp date match to exact match days exactly (#3344)
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonF authored Dec 17, 2024
1 parent 64bcb4b commit 72c7acc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions src/components/pnp/verifyEngagementDateRangeMatches.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { stripIndent } from 'common-tags';
import { DateTime } from 'luxon';
import { DateInterval } from '~/common';
import {
PnpPlanningExtractionResult,
Expand All @@ -19,10 +20,7 @@ export function verifyEngagementDateRangeMatches(
}

const matches =
engagementRange &&
pnpRange &&
// PnP only specifies months; allow nuance on our side.
engagementRange.expandToFull('month').equals(pnpRange);
engagementRange && pnpRange && engagementRange.equals(pnpRange);

if (matches) {
return true;
Expand Down Expand Up @@ -68,13 +66,11 @@ const MismatchedEngagementDateRange = PnpProblemType.register({
message: stripIndent`
The PnP's **project dates** (\`${source}\`) are different from what is declared in the CORD Engagement/Project.
CORD: ${eng.toLocaleString({ month: 'long', year: 'numeric' })}
PnP: ${pnp.toLocaleString({ month: 'long', year: 'numeric' })}
CORD: ${eng.toLocaleString(DateTime.DATE_MED)}
PnP: ${pnp.toLocaleString(DateTime.DATE_MED)}
Please adjust the dates in CORD or the PnP to match and be accurate.
CORD only requires the month & year to match the PnP since this is as granular as it gets.
If this is a cluster project and this engagement ("language") has started late or ends early,
that difference can be declared in CORD's _Engagement dates_.
`.replaceAll(/\n/g, ' \n'), // keep line breaks with MD's two space trailers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { FileVersion } from '../../file/dto';
import { PeriodicReportUploadedEvent } from '../../periodic-report/events';
import { ProgressReport } from '../dto';

@Migration('2024-12-16T16:33:00')
@Migration('2024-12-17T16:00:00')
export class ReextractPnpProgressReportsMigration extends BaseMigration {
constructor(
private readonly eventBus: IEventBus,
Expand Down

0 comments on commit 72c7acc

Please sign in to comment.