Skip to content

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

change dayservice to be used for NWDs

bsatarnejad8fa3954ae92e
diff --git a/frontend/src/app/core/apiv3/endpoints/days/api-v3-days-paths.ts b/frontend/src/app/core/apiv3/endpoints/days/api-v3-days-paths.ts
index 899c1bb2756..509a581a99a 100644
--- a/frontend/src/app/core/apiv3/endpoints/days/api-v3-days-paths.ts
+++ b/frontend/src/app/core/apiv3/endpoints/days/api-v3-days-paths.ts
@@ -47,4 +47,7 @@ export class ApiV3DaysPaths extends ApiV3ResourceCollection<IDay, ApiV3DayPaths>
// /api/v3/days/week
public readonly week = new ApiV3GettableResource(this.apiRoot, this.path, 'week', this);
+
+ // /api/v3/days/nonWorkingDays
+ public readonly nonWorkingDays = new ApiV3GettableResource(this.apiRoot, this.path, 'non_working', this);
}
diff --git a/frontend/src/app/core/state/days/day.service.ts b/frontend/src/app/core/state/days/day.service.ts
index 2f96090e5fd..657b6fb653d 100644
--- a/frontend/src/app/core/state/days/day.service.ts
+++ b/frontend/src/app/core/state/days/day.service.ts
@@ -12,7 +12,6 @@ import {
} from 'core-app/core/apiv3/paths/apiv3-list-resource.interface';
import {
collectionKey,
- extendCollectionElementsWithId,
insertCollectionIntoState,
removeCollectionLoading,
setCollectionLoading,
@@ -30,6 +29,7 @@ export class DayResourceService extends ResourceCollectionService<IDay> {
return this
.apiV3Service
.days
+ .nonWorkingDays
.path;
}
@@ -39,17 +39,22 @@ export class DayResourceService extends ResourceCollectionService<IDay> {
return this
.requireNonWorkingYear$(input)
.pipe(
- map((days) => days.findIndex((day:IDay) => !day.working && day.date === date) !== -1),
+ map((days) => days.findIndex((day:IDay) => day.date === date) !== -1),
);
}
+ public isNonWorkingDay(date:Date):boolean {
+ let isNonWorkingDay = false;
+ this.isNonWorkingDay$(date).subscribe((isNonWorking) => { isNonWorkingDay = isNonWorking; });
+ return isNonWorkingDay;
+ }
+
requireNonWorkingYear$(date:Date):Observable<IDay[]> {
const from = moment(date).startOf('year').format('YYYY-MM-DD');
const to = moment(date).endOf('year').format('YYYY-MM-DD');
const filters:ApiV3ListFilter[] = [
['date', '<>d', [from, to]],
- ['working', '=', ['f']],
];
return this.require({ filters });
@@ -64,7 +69,6 @@ export class DayResourceService extends ResourceCollectionService<IDay> {
.http
.get<IHALCollection<IDay>>(this.basePath() + collectionURL)
.pipe(
- map((collection) => extendCollectionElementsWithId(collection)),
tap((collection) => insertCollectionIntoState(this.store, collection, collectionURL)),
finalize(() => removeCollectionLoading(this.store, collectionURL)),
);