Skip to content
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

POC-885: fixed Lists not getting generated due to weeks overlap in th… #1776

Merged
merged 4 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ name: Ng2-amrs CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
build:

runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -40,7 +39,7 @@ jobs:
- name: Build prod
run: npm run build-prod
- name: Upload build files to artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: build-files
path: dist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import * as _ from 'lodash';
import { Subscription } from 'rxjs';
import { PreAppointmentOutreachResourceService } from 'src/app/etl-api/pre-appointment-outreach-resource.service';
import { getISOWeek } from 'date-fns';

interface ReportParams {
locationUuids: string;
Expand Down Expand Up @@ -53,7 +54,7 @@ export class PreAppointmentOutreachComponent implements OnInit {
private route: ActivatedRoute
) {
const today = new Date();
const currentWeek = this.getISOWeek(today);
const currentWeek = getISOWeek(today);
const currentYear = today.getFullYear();
const startYear = 2023;
const numberOfWeeks = 52; // Set the maximum number of weeks to 52
Expand Down Expand Up @@ -361,21 +362,4 @@ export class PreAppointmentOutreachComponent implements OnInit {
(day - 1) * 24 * 60 * 60 * 1000
);
}

private getISOWeek(date: Date): number {
const firstDayOfYear = new Date(date.getFullYear(), 0, 1);
const daysOffset = firstDayOfYear.getDay() - 1;
const firstMondayOfYear = new Date(
firstDayOfYear.getFullYear(),
0,
1 + (daysOffset > 0 ? 7 - daysOffset : 0)
);

const daysPassed = Math.floor(
(date.getTime() - firstMondayOfYear.getTime()) / 86400000
);
const weeksPassed = Math.floor(daysPassed / 7) + 1;

return weeksPassed;
}
}
Loading