1
- import { Component , computed , inject , linkedSignal } from '@angular/core' ;
2
- import { toSignal } from '@angular/core/rxjs-interop' ;
3
- import { map } from 'rxjs' ;
4
- import { ComparisonScoreDistribution } from '../../shared/comparison/comparison-score-distribution' ;
5
- import { ComparisonBuildDistribution } from '../../shared/comparison/comparison-build-distribution' ;
6
- import { ModelComparisonData } from '../../shared/comparison/comparison-data' ;
7
- import { ReportsFetcher } from '../../services/reports-fetcher' ;
8
- import { ReportSelect } from '../../shared/report-select/report-select' ;
9
- import { ComparisonRuntimeDistribution } from '../../shared/comparison/comparison-runtime-distribution' ;
10
- import { ActivatedRoute } from '@angular/router' ;
1
+ import { Component , computed , inject , linkedSignal } from '@angular/core' ;
2
+ import { toSignal } from '@angular/core/rxjs-interop' ;
3
+ import { map } from 'rxjs' ;
4
+ import { ComparisonScoreDistribution } from '../../shared/comparison/comparison-score-distribution' ;
5
+ import { ComparisonBuildDistribution } from '../../shared/comparison/comparison-build-distribution' ;
6
+ import { ModelComparisonData } from '../../shared/comparison/comparison-data' ;
7
+ import { ReportsFetcher } from '../../services/reports-fetcher' ;
8
+ import { ReportSelect } from '../../shared/report-select/report-select' ;
9
+ import { ComparisonRuntimeDistribution } from '../../shared/comparison/comparison-runtime-distribution' ;
10
+ import { ActivatedRoute } from '@angular/router' ;
11
11
12
12
@Component ( {
13
13
templateUrl : './comparison.html' ,
@@ -31,10 +31,10 @@ export class ComparisonPage {
31
31
} ) ,
32
32
computation : ( ) => {
33
33
const allGroups = this . groups ( ) ;
34
- const results : { reportName : string ; groupId : string | null } [ ] = [ ] ;
34
+ const results : { reportName : string ; groupId : string | null } [ ] = [ ] ;
35
35
36
- this . selectedGroups ( ) . forEach ( ( id ) => {
37
- const correspondingGroup = allGroups . find ( ( group ) => group . id === id ) ;
36
+ this . selectedGroups ( ) . forEach ( id => {
37
+ const correspondingGroup = allGroups . find ( group => group . id === id ) ;
38
38
39
39
if ( correspondingGroup ) {
40
40
results . push ( {
@@ -50,34 +50,33 @@ export class ComparisonPage {
50
50
51
51
readonly selectedGroups = toSignal < string [ ] > (
52
52
this . route . queryParams . pipe (
53
- map ( ( params ) => {
53
+ map ( params => {
54
54
const ids = params [ 'groups' ] ;
55
55
return ids && Array . isArray ( ids ) ? ids : [ ] ;
56
- } )
56
+ } ) ,
57
57
) ,
58
- { requireSync : true }
58
+ { requireSync : true } ,
59
59
) ;
60
60
61
61
readonly comparisonModelData = computed ( ( ) => {
62
62
const allGroups = this . groups ( ) ;
63
63
const selectedGroups = this . groupsToCompare ( )
64
- . map ( ( g ) => ( {
64
+ . map ( g => ( {
65
65
reportName : g . reportName ,
66
- group : allGroups . find ( ( current ) => current . id === g . groupId ) ! ,
66
+ group : allGroups . find ( current => current . id === g . groupId ) ! ,
67
67
} ) )
68
- . filter ( ( g ) => ! ! g . group ) ;
68
+ . filter ( g => ! ! g . group ) ;
69
69
70
70
if ( selectedGroups . length < 2 ) {
71
71
return null ;
72
72
}
73
73
74
74
return {
75
75
averageAppsCount : Math . floor (
76
- selectedGroups . reduce ( ( acc , r ) => r . group . appsCount + acc , 0 ) /
77
- selectedGroups . length
76
+ selectedGroups . reduce ( ( acc , r ) => r . group . appsCount + acc , 0 ) / selectedGroups . length ,
78
77
) ,
79
78
series : [
80
- ...selectedGroups . map ( ( r ) => ( {
79
+ ...selectedGroups . map ( r => ( {
81
80
name : r . reportName ,
82
81
stats : r . group . stats ,
83
82
appsCount : r . group . appsCount ,
@@ -86,15 +85,15 @@ export class ComparisonPage {
86
85
} satisfies ModelComparisonData ;
87
86
} ) ;
88
87
89
- protected updateReportName ( report : { reportName : string } , newName : string ) {
88
+ protected updateReportName ( report : { reportName : string } , newName : string ) {
90
89
report . reportName = newName ;
91
90
this . groupsToCompare . set ( [ ...this . groupsToCompare ( ) ] ) ;
92
91
}
93
92
94
93
protected setSelectedGroup ( index : number , groupId : string | undefined ) {
95
94
const allGroups = this . groups ( ) ;
96
95
const current = this . groupsToCompare ( ) ;
97
- const correspondingGroup = allGroups . find ( ( group ) => group . id === groupId ) ;
96
+ const correspondingGroup = allGroups . find ( group => group . id === groupId ) ;
98
97
99
98
if ( correspondingGroup ) {
100
99
current [ index ] = {
0 commit comments