Commit 75e49cdb by Nattana Chaiyamat

แก้คำนวนgap

parent d5bd6e2e
...@@ -240,16 +240,16 @@ export class PmsCompetencyComponent { ...@@ -240,16 +240,16 @@ export class PmsCompetencyComponent {
return "1"; return "1";
} }
} }
calGap(score: number | string) { calGap(score: number | string, index?: string) {
if (this.appraisalCompentencyList[this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0]) { if (this.appraisalCompentencyList[index ? +(index) : this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0]) {
const roundedScore = this.showNumber(score) % 1 <= 0.5 ? Math.floor(this.showNumber(score)) : Math.round(this.showNumber(score)); const roundedScore = this.showNumber(score) % 1 <= 0.5 ? Math.floor(this.showNumber(score)) : Math.round(this.showNumber(score));
if (roundedScore >= 90 && roundedScore <= 100) { if (roundedScore >= 90 && roundedScore <= 100) {
if (this.appraisalCompentencyList[this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0].numberCheck1 || this.appraisalCompentencyList[this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0].numberCheck2 || this.appraisalCompentencyList[this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0].numberCheck3) { if (this.appraisalCompentencyList[index ? +(index) : this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0].numberCheck1 || this.appraisalCompentencyList[index ? +(index) : this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0].numberCheck2 || this.appraisalCompentencyList[index ? +(index) : this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0].numberCheck3) {
return "-1"; return "-1";
} }
return "+1"; return "+1";
} else if (roundedScore >= 80 && roundedScore <= 89) { } else if (roundedScore >= 80 && roundedScore <= 89) {
if (this.appraisalCompentencyList[this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0].numberCheck1 || this.appraisalCompentencyList[this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0].numberCheck2 || this.appraisalCompentencyList[this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0].numberCheck3) { if (this.appraisalCompentencyList[index ? +(index) : this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0].numberCheck1 || this.appraisalCompentencyList[index ? +(index) : this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0].numberCheck2 || this.appraisalCompentencyList[index ? +(index) : this.appraisalCompentencyIndex]?.masfromEvaluationAssessment1lList[0].numberCheck3) {
return "-1"; return "-1";
} }
return "0"; return "0";
...@@ -311,9 +311,9 @@ export class PmsCompetencyComponent { ...@@ -311,9 +311,9 @@ export class PmsCompetencyComponent {
this.compentencyFormRemain.emit(remain) this.compentencyFormRemain.emit(remain)
} }
allWeightGap() { allWeightGap() {
this.appraisalCompentencyList.forEach(x => { this.appraisalCompentencyList.forEach((x, i) => {
this.inforWeight.set(x.comType, x.masfromEvaluationAssessment1lList[0].averageScore + '') this.inforWeight.set(x.comType, x.masfromEvaluationAssessment1lList[0].averageScore + '')
this.inforGap.set(x.comType, this.calGap(x.masfromEvaluationAssessment1lList[0].averageScore) ?? '') this.inforGap.set(x.comType, this.calGap(x.masfromEvaluationAssessment1lList[0].averageScore, (i + '')) ?? '')
}) })
this.sendInforWeight.emit(this.inforWeight) this.sendInforWeight.emit(this.inforWeight)
this.sendInforGap.emit(this.inforGap) this.sendInforGap.emit(this.inforGap)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment