File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ export class ProjectViewComponent implements OnInit {
71
71
72
72
getNumberOfFails ( id : number ) {
73
73
const stats : TestRunStat = this . testRunStats . filter ( x => x . id === id ) [ 0 ] ;
74
- return stats ? ( ( stats . passed / stats . total ) * 100 ) . toFixed ( 2 ) : 0 ;
74
+ return this . testrunService . getPassRate ( stats ) ;
75
75
}
76
76
77
77
openTestRun ( testRunId : number ) {
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ export class TestRunsComponent implements OnInit {
66
66
run [ 'duration' ] = new Date ( run . finish_time ) . getTime ( ) - new Date ( run . start_time ) . getTime ( ) ;
67
67
run [ 'totalTests' ] = ( this . testRunStats . find ( stat => stat . id === run . id ) || { 'total' : 0 } ) . total ;
68
68
run [ 'not_assigned' ] = ( this . testRunStats . find ( stat => stat . id === run . id ) || { 'not_assigned' : 0 } ) . not_assigned ;
69
- run [ 'passrate' ] = this . getPassRate ( this . testRunStats . find ( stat => stat . id === run . id ) || new TestRunStat ( ) ) ;
69
+ run [ 'passrate' ] = this . testrunService . getPassRate ( this . testRunStats . find ( stat => stat . id === run . id ) || new TestRunStat ( ) ) ;
70
70
}
71
71
} ) ;
72
72
this . tbCols = [
@@ -187,10 +187,6 @@ export class TestRunsComponent implements OnInit {
187
187
this . hideModal = $event ;
188
188
}
189
189
190
- getPassRate ( stat : TestRunStat ) {
191
- return stat ? ( ( stat . passed / stat . total ) * 100 ) . toFixed ( 2 ) : 0 ;
192
- }
193
-
194
190
uploadResults ( ) {
195
191
const columns = [
196
192
{ name : 'Test Run ID' , property : 'test_run_id' } ,
Original file line number Diff line number Diff line change @@ -60,4 +60,8 @@ export class TestRunService extends SimpleRequester {
60
60
const seconds = duration - ( hours * 3600 + minutes * 60 ) ;
61
61
return hours + 'h:' + minutes + 'm:' + seconds + 's' ;
62
62
}
63
+
64
+ getPassRate ( stat : TestRunStat ) : string | number {
65
+ return stat ? ( ( stat . passed / stat . total ) * 100 ) . toFixed ( 2 ) : 0 ;
66
+ }
63
67
}
You can’t perform that action at this time.
0 commit comments