diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6c6dc1a4a..e55f9dfdc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: @@ -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 diff --git a/src/app/clinic-dashboard/general/pre-appointment-outreach/pre-appointment-outreach.component.ts b/src/app/clinic-dashboard/general/pre-appointment-outreach/pre-appointment-outreach.component.ts index adc07d908..3a5de872c 100644 --- a/src/app/clinic-dashboard/general/pre-appointment-outreach/pre-appointment-outreach.component.ts +++ b/src/app/clinic-dashboard/general/pre-appointment-outreach/pre-appointment-outreach.component.ts @@ -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; @@ -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 @@ -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; - } }