Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
arawinters committed Nov 20, 2023
1 parent 1a807a0 commit 9073c06
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/lib/entity/detail/sz-entity-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,7 @@ export class SzEntityDetailComponent implements OnInit, OnDestroy, AfterViewInit
}
if(this._dynamicHowFeatures) {
this._howFunctionDisabled = (this._dynamicHowFeatures && !results[0]);
this._entityRequiresReEvaluation = (this._dynamicHowFeatures && !results[0]);
this._entityRequiresReEvaluation = (this._dynamicHowFeatures && results[1]);
}
})
if(this._entityId){
Expand All @@ -1211,14 +1211,26 @@ export class SzEntityDetailComponent implements OnInit, OnDestroy, AfterViewInit
take(1)
).subscribe({
next: (resp)=>{
console.info(`checkIfEntityHasHowSteps: `, resp);
if(resp && resp.data && resp.data && (resp.data.resolutionSteps && Object.keys(resp.data.resolutionSteps).length <= 0 && resp.data.finalStates && resp.data.finalStates.length > 0)){
let hasSteps = (resp && resp.data && resp.data.resolutionSteps && Object.keys(resp.data.resolutionSteps).length > 0);
let numberOfFinalStates = resp && resp.data && resp.data.finalStates && resp.data.finalStates.length ? resp.data.finalStates.length : 0
let isSingleton = (numberOfFinalStates === 1 && resp && resp.data && resp.data.finalStates && resp.data.finalStates[0]) ? resp.data.finalStates[0].singleton: false;

if(isSingleton) {
// entity only has one record,
// dont show re-eval
_retObs.next([false, false]);
} else if (!hasSteps || numberOfFinalStates > 1){
// no resolution steps and more than one final state
// needs re-evaluation
_retObs.next([false, true]);
} else if(resp && resp.data && resp.data.resolutionSteps && Object.keys(resp.data.resolutionSteps).length > 0) {
_retObs.next([true, false]);
//console.warn(`needs re-evaluation`);
} else if(hasSteps && numberOfFinalStates < 1) {
// has resolution steps but no final states???
// disable the button
_retObs.next([hasSteps, true]);
} else {
_retObs.next([false, false]);
// resolution was normal
_retObs.next([hasSteps, false]);
}
},
error: (err) => {
Expand Down

0 comments on commit 9073c06

Please sign in to comment.