fix report & find commander
This commit is contained in:
parent
38bb51f491
commit
94eb53bcc9
2 changed files with 11 additions and 4 deletions
|
|
@ -1152,9 +1152,11 @@ export class ProfileController extends Controller {
|
||||||
const profile = await this.profileRepo.findOne({
|
const profile = await this.profileRepo.findOne({
|
||||||
where: { keycloak: request.user.sub },
|
where: { keycloak: request.user.sub },
|
||||||
});
|
});
|
||||||
|
|
||||||
const posMaster = await this.posMasterRepo.findOne({
|
const posMaster = await this.posMasterRepo.findOne({
|
||||||
where: { current_holderId: profile?.id },
|
where: {
|
||||||
|
current_holderId: profile?.id,
|
||||||
|
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
||||||
|
},
|
||||||
});
|
});
|
||||||
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลการครองตำแหน่ง");
|
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลการครองตำแหน่ง");
|
||||||
const orgRoot = posMaster.orgRootId;
|
const orgRoot = posMaster.orgRootId;
|
||||||
|
|
@ -1870,7 +1872,10 @@ export class ProfileController extends Controller {
|
||||||
});
|
});
|
||||||
|
|
||||||
const posMaster = await this.posMasterRepo.findOne({
|
const posMaster = await this.posMasterRepo.findOne({
|
||||||
where: { current_holderId: profile?.id },
|
where: {
|
||||||
|
current_holderId: profile?.id,
|
||||||
|
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
||||||
|
},
|
||||||
});
|
});
|
||||||
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลการครองตำแหน่ง");
|
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลการครองตำแหน่ง");
|
||||||
const orgRoot = posMaster.orgRootId;
|
const orgRoot = posMaster.orgRootId;
|
||||||
|
|
|
||||||
|
|
@ -6603,6 +6603,7 @@ export class ReportController extends Controller {
|
||||||
typeRank: [...new Set(x.positions.flatMap((y) => y.posType.posTypeRank))].join(""),
|
typeRank: [...new Set(x.positions.flatMap((y) => y.posType.posTypeRank))].join(""),
|
||||||
level: [...new Set(x.positions.flatMap((y) => y.posLevel.posLevelName))].join(","),
|
level: [...new Set(x.positions.flatMap((y) => y.posLevel.posLevelName))].join(","),
|
||||||
levelRank: [...new Set(x.positions.flatMap((y) => `${y.posType.posTypeRank}${y.posLevel.posLevelRank}`))].join(""),
|
levelRank: [...new Set(x.positions.flatMap((y) => `${y.posType.posTypeRank}${y.posLevel.posLevelRank}`))].join(""),
|
||||||
|
positions: [...new Set(x.positions.flatMap((y) => y.positionName))].join(""),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const groupedData = _posMaster.reduce((acc:any, curr:any) => {
|
const groupedData = _posMaster.reduce((acc:any, curr:any) => {
|
||||||
|
|
@ -6621,8 +6622,9 @@ export class ReportController extends Controller {
|
||||||
typeRank: parseInt(x.typeRank),
|
typeRank: parseInt(x.typeRank),
|
||||||
level: x.level,
|
level: x.level,
|
||||||
levelRank: parseInt(x.levelRank),
|
levelRank: parseInt(x.levelRank),
|
||||||
|
|
||||||
total: x.total,
|
total: x.total,
|
||||||
remark: "",
|
remark: x.positions,
|
||||||
}))
|
}))
|
||||||
.sort((x, y) => {
|
.sort((x, y) => {
|
||||||
if (x.typeRank !== y.typeRank) {
|
if (x.typeRank !== y.typeRank) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue