rez_core 2.2.44 → 2.2.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.2.44",
3
+ "version": "2.2.47",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -12,24 +12,27 @@ export class ViewMaster extends BaseEntity {
12
12
  @Column({ length: 50, nullable: true })
13
13
  mapped_entity_type: string;
14
14
 
15
+ @Column({ type: 'int', nullable: true })
16
+ mapped_entity_id: number;
17
+
15
18
  @Column({ length: 50, nullable: true })
16
19
  identifier: string;
17
20
 
18
- @Column({nullable: true})
21
+ @Column({ nullable: true })
19
22
  description: string;
20
23
 
21
- @Column({type: 'json', nullable: true})
24
+ @Column({ type: 'json', nullable: true })
22
25
  published_form_layout: string;
23
26
 
24
- @Column({type: 'json', nullable: true})
27
+ @Column({ type: 'json', nullable: true })
25
28
  published_form_fields: string;
26
29
 
27
- @Column({type: 'json',nullable:true})
28
- meta_json:string;
30
+ @Column({ type: 'json', nullable: true })
31
+ meta_json: string;
29
32
 
30
- @Column({ nullable:true})
33
+ @Column({ nullable: true })
31
34
  type: string;
32
35
 
33
- @Column({type: 'int'})
36
+ @Column({ type: 'int' })
34
37
  is_default: number;
35
38
  }
@@ -42,9 +42,10 @@ export class ViewMasterService extends EntityServiceImpl {
42
42
 
43
43
  async updateEntity(
44
44
  entityData: ViewMaster,
45
- loggedInUserData: UserData | null,
45
+ loggedInUserData: UserData,
46
46
  ): Promise<BaseEntity> {
47
- return entityData;
47
+ const res = await super.updateEntity(entityData, loggedInUserData);
48
+ return res;
48
49
  }
49
50
 
50
51
  async getEntityJson(entityType: string, type: string) {
@@ -69,7 +70,7 @@ export class ViewMasterService extends EntityServiceImpl {
69
70
  entityType: string,
70
71
  id: number,
71
72
  loggedInUserData?: UserData | null,
72
- ) {
73
- return await super.getEntityData(entityType, id,loggedInUserData);
73
+ ) {
74
+ return await super.getEntityData(entityType, id, loggedInUserData);
74
75
  }
75
76
  }
@@ -21,10 +21,10 @@ export class StageMovementData extends BaseEntity {
21
21
  @Column({ type: 'int', nullable: true })
22
22
  stage_id: number;
23
23
 
24
- @Column({ type: 'date', nullable: true })
24
+ @Column({ nullable: true })
25
25
  start_date: Date;
26
26
 
27
- @Column({ type: 'date', nullable: true })
27
+ @Column({ nullable: true })
28
28
  end_date: Date;
29
29
 
30
30
  @Column({ type: 'varchar', nullable: true })
@@ -89,7 +89,8 @@ export class StageGroupService extends EntityServiceImpl {
89
89
  stageMovementMap.set(movement.stage_id, movement);
90
90
  }
91
91
 
92
- // 6. Attach movement info to each stage
92
+ let foundInProgressGroup = false;
93
+
93
94
  for (const group of stageGroupAndStageHierarchy) {
94
95
  for (const stage of group.stages || []) {
95
96
  const movement = stageMovementMap.get(Number(stage.id));
@@ -105,7 +106,7 @@ export class StageGroupService extends EntityServiceImpl {
105
106
  : null;
106
107
  stage.time_spent = await this.calculateTimeSpent(
107
108
  movement.start_date,
108
- movement.end_date ?? new Date(), // fallback to current datetime
109
+ movement.end_date ?? new Date(),
109
110
  );
110
111
  } else {
111
112
  stage.is_current = false;
@@ -117,13 +118,24 @@ export class StageGroupService extends EntityServiceImpl {
117
118
  }
118
119
  }
119
120
 
120
- // 7. Set stage_group_status based on all its stages
121
- group.stage_group_status =
122
- group.stages && group.stages.length > 0
123
- ? group.stages.every((stage) => stage.is_done)
124
- ? 'COMPLETED'
125
- : 'IN_PROGRESS'
126
- : 'NOT_STARTED';
121
+ if (group.stages.length === 0) {
122
+ group.stage_group_status = 'TODO';
123
+ continue;
124
+ }
125
+
126
+ const allDone = group.stages.every((s) => s.is_done);
127
+ const noneStarted = group.stages.every(
128
+ (s) => !s.is_current && !s.is_done,
129
+ );
130
+
131
+ if (allDone) {
132
+ group.stage_group_status = 'COMPLETED';
133
+ } else if (!foundInProgressGroup && !noneStarted) {
134
+ group.stage_group_status = 'IN_PROGRESS';
135
+ foundInProgressGroup = true;
136
+ } else {
137
+ group.stage_group_status = 'TODO';
138
+ }
127
139
  }
128
140
 
129
141
  return stageGroupAndStageHierarchy;
@@ -138,7 +138,7 @@ export class WorkflowMetaService extends EntityServiceImpl {
138
138
  orgnization_id: loggedInUser.organization_id,
139
139
  stage_group_id: stageGroup.id,
140
140
  stage_id: firstStage.id,
141
- start_date: new Date(),
141
+ start_date: Date.now(),
142
142
  is_current: 'Y',
143
143
  });
144
144