OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[60410] Fetch calendar non-working days for the full date range
Christophe Bliard15a941598a32
diff --git a/frontend/src/app/features/calendar/op-work-packages-calendar.service.ts b/frontend/src/app/features/calendar/op-work-packages-calendar.service.tsindex 2a854e746d6..c8569e0e911 100644--- a/frontend/src/app/features/calendar/op-work-packages-calendar.service.ts+++ b/frontend/src/app/features/calendar/op-work-packages-calendar.service.ts@@ -147,8 +147,8 @@ export class OpWorkPackagesCalendarService extends UntilDestroyedMixin {}}- async requireNonWorkingDays(date:Date|string) {- this.nonWorkingDays = await firstValueFrom(this.dayService.requireNonWorkingYear$(date));+ async requireNonWorkingDays(start:Date|string, end:Date|string) {+ this.nonWorkingDays = await firstValueFrom(this.dayService.requireNonWorkingYears$(start, end));}isNonWorkingDay(date:Date|string):boolean {@@ -160,8 +160,7 @@ export class OpWorkPackagesCalendarService extends UntilDestroyedMixin {fetchInfo:{ start:Date, end:Date, timeZone:string },projectIdentifier:string|undefined,):Promise<unknown> {- await this.requireNonWorkingDays(fetchInfo.start);- await this.requireNonWorkingDays(fetchInfo.end);+ await this.requireNonWorkingDays(fetchInfo.start, fetchInfo.end);if (this.areFiltersEmpty && this.querySpace.query.value) {// nothing to dodiff --git a/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts b/frontend/src/app/features/calendar/te-calendar/te-calendar.component.tsindex 6216191458f..8634c379544 100644--- a/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts+++ b/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts@@ -181,8 +181,9 @@ export class TimeEntryCalendarComponent {void this.weekdayService.loadWeekdays().toPromise().then(async () => {- const date = moment(new Date()).toString();- await this.requireNonWorkingDays(date);+ const startOfWeek = moment().startOf('week').format('YYYY-MM-DD');+ const endOfWeek = moment().endOf('week').format('YYYY-MM-DD');+ await this.requireNonWorkingDays(startOfWeek, endOfWeek);this.additionalOptions.hiddenDays = this.setHiddenDays(displayedDayss);this.calendarOptions$.next(this.additionalOptions,@@ -211,8 +212,8 @@ export class TimeEntryCalendarComponent {readonly dayService:DayResourceService,) {}- async requireNonWorkingDays(date:Date|string) {- this.nonWorkingDays = await firstValueFrom(this.dayService.requireNonWorkingYear$(date));+ async requireNonWorkingDays(start:Date|string, end:Date|string) {+ this.nonWorkingDays = await firstValueFrom(this.dayService.requireNonWorkingYears$(start, end));}public calendarEventsFunction(@@ -255,8 +256,7 @@ export class TimeEntryCalendarComponent {private async buildEntries(entries:TimeEntryResource[], fetchInfo:{ start:Date, end:Date }):Promise<EventInput[]> {this.setRatio(entries);- await this.requireNonWorkingDays(fetchInfo.start);- await this.requireNonWorkingDays(fetchInfo.end);+ await this.requireNonWorkingDays(fetchInfo.start, fetchInfo.end);return this.buildTimeEntryEntries(entries).concat(this.buildAuxEntries(entries, fetchInfo));}