From 8cd5b1de6acbe3db804865681ced2135e0fa50dc Mon Sep 17 00:00:00 2001 From: Kipkemoii Date: Fri, 3 Jan 2025 16:07:35 +0300 Subject: [PATCH 1/4] POC-885: fixed Lists not getting generated due to weeks overlap in the new and past year --- .../pre-appointment-outreach.component.ts | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) 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..4560af84d 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 @@ -86,7 +87,7 @@ export class PreAppointmentOutreachComponent implements OnInit { public setSelectedWeek() { this.selectedFormattedWeek = this.weeks.find( (week) => week.value === this.selectedWeek - ).label; + ); } public setSelectedFilterType() { @@ -362,20 +363,21 @@ export class PreAppointmentOutreachComponent implements OnInit { ); } - 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) - ); + // private getISOWeek(date: Date): number { + // const firstDayOfYear = new Date(date.getFullYear(), 0, 1); + // console.log('current dY OF THE YEAR: ', firstDayOfYear); + // 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; + // const daysPassed = Math.floor( + // (date.getTime() - firstMondayOfYear.getTime()) / 86400000 + // ); + // const weeksPassed = Math.floor(daysPassed / 7) + 1; - return weeksPassed; - } + // return weeksPassed; + // } } From c9f1e799098692b1e532a07fc9c9bd08793030e6 Mon Sep 17 00:00:00 2001 From: Kipkemoii Date: Mon, 6 Jan 2025 10:31:50 +0300 Subject: [PATCH 2/4] POC-885: fixed missing label in year week --- .../pre-appointment-outreach.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4560af84d..93c2f32f8 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 @@ -87,7 +87,7 @@ export class PreAppointmentOutreachComponent implements OnInit { public setSelectedWeek() { this.selectedFormattedWeek = this.weeks.find( (week) => week.value === this.selectedWeek - ); + ).label; } public setSelectedFilterType() { From f2a00bd3a57cc067e65d3553cc659846bd8306d2 Mon Sep 17 00:00:00 2001 From: Kipkemoii Date: Mon, 6 Jan 2025 11:43:30 +0300 Subject: [PATCH 3/4] updated github actions version --- .github/workflows/main.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 From 0c9d7358ae0f361d431f4491802c7c1092c5c201 Mon Sep 17 00:00:00 2001 From: Kipkemoii Date: Mon, 6 Jan 2025 11:47:59 +0300 Subject: [PATCH 4/4] remove custom getISOWeek function --- .../pre-appointment-outreach.component.ts | 18 ------------------ 1 file changed, 18 deletions(-) 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 93c2f32f8..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 @@ -362,22 +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); - // console.log('current dY OF THE YEAR: ', firstDayOfYear); - // 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; - // } }