陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Quintiq file version 2.0
#parent: #root
MethodOverride CreateIssue (LibOpt_SnapshotSuboptimizer snapshotsuboptimizer, String issuetype, const constcontent LibOpt_StatisticSeverityScaleEntrys severityscaleentries_lowerthresholdviolation, 
  const constcontent LibOpt_StatisticSeverityScaleEntrys severityscaleentries_upperthresholdviolation)
{
  Description: 'Create a `LibOpt_Issue` for the given "snapshot suboptimizer" (`LibOpt_SnapshotSuboptimizer`) if its `LibOpt_SnapshotSuboptimizer.Improvement` value corresponding to this statistic violates the `LowerThreshold` / `UpperThreshold`.'
  TextBody:
  [*
    // Variables needed for Issues creation.
    shouldcreateissue := false;
    severity := 0.0;
    
    kpi_improvement := BinaryValueUtils::RealVectorGetElement( snapshotsuboptimizer,
                                                               attribute( LibOpt_SnapshotSuboptimizer, Improvement ),
                                                               this.KPILevel() - 1
                                                             );
    
    if( kpi_improvement < this.LowerThreshold() )
    {
      shouldcreateissue := true;
      
      severity := this.GetSeverity( kpi_improvement, false /*is upper threshold violation*/, severityscaleentries_lowerthresholdviolation );
    }
    else if( kpi_improvement > this.UpperThreshold() )
    {
      shouldcreateissue := true;
      
      severity := this.GetSeverity( kpi_improvement, true /*is upper threshold violation*/, severityscaleentries_upperthresholdviolation );
    }
    
    if( shouldcreateissue )
    {
      // Create an Issue and link it to the relevant Snapshot.
      LibOpt_Issue::Create( this,
                            snapshotsuboptimizer,
                            issuetype,
                            this.Focus() + ', ' + Translations::LibOpt_IterationNr( snapshotsuboptimizer.GetIteration().IterationNr(), this.Run().TotalNrOfIterations() ),
                            severity,
                            Translations::LibOpt_Issue_Details_SuboptimizerKPIImprovement( kpi_improvement,
                                                                                           this.LowerThreshold(),
                                                                                           this.UpperThreshold(),
                                                                                           LibOpt_Statistic::GetFormat( kpi_improvement,
                                                                                                                        this.LowerThreshold(),
                                                                                                                        this.UpperThreshold() ) )
                          );
    }
  *]
}