@@ -52,6 +52,21 @@ function pre_process_data (data, callback) {
52
52
} )
53
53
}
54
54
55
+ function formatDuration ( seconds ) {
56
+ let numSecondsInDay = 24 * 60 * 60 ;
57
+ let days = Math . floor ( seconds / numSecondsInDay ) ;
58
+ let rest = seconds % numSecondsInDay ;
59
+
60
+ let date = new Date ( 0 ) ;
61
+ date . setSeconds ( rest ) ;
62
+ let timeString = date . toISOString ( ) . substr ( 11 , 8 ) ;
63
+
64
+ if ( days ) {
65
+ return `${ days } ${ timeString } ` ;
66
+ }
67
+ return `${ timeString } ` ;
68
+ }
69
+
55
70
$ ( document ) . ready ( function ( ) {
56
71
const table = $ ( '#resultsTable' ) . DataTable ( {
57
72
pageLength : $ ( '#navbar' ) . data ( 'defaultpagesize' ) ,
@@ -106,6 +121,18 @@ $(document).ready(function () {
106
121
params . is_automated = false
107
122
} ;
108
123
124
+ if ( ! [ '' , '0' ] . includes ( $ ( '#id_setup_duration' ) . val ( ) ) ) {
125
+ params . setup_duration = $ ( '#id_setup_duration' ) . val ( )
126
+ } ;
127
+
128
+ if ( ! [ '' , '0' ] . includes ( $ ( '#id_testing_duration' ) . val ( ) ) ) {
129
+ params . testing_duration = $ ( '#id_testing_duration' ) . val ( )
130
+ } ;
131
+
132
+ if ( ! [ '' , '0' ] . includes ( $ ( '#id_expected_duration' ) . val ( ) ) ) {
133
+ params . expected_duration = $ ( '#id_expected_duration' ) . val ( )
134
+ } ;
135
+
109
136
const text = $ ( '#id_text' ) . val ( )
110
137
if ( text ) {
111
138
params . text__icontains = text
@@ -145,7 +172,25 @@ $(document).ready(function () {
145
172
{ data : 'case_status__name' } ,
146
173
{ data : 'is_automated' } ,
147
174
{ data : 'author__username' } ,
148
- { data : 'tag_names' }
175
+ { data : 'tag_names' } ,
176
+ {
177
+ data : 'setup_duration' ,
178
+ render : function ( data , type , full , meta ) {
179
+ return formatDuration ( data ) ;
180
+ }
181
+ } ,
182
+ {
183
+ data : 'testing_duration' ,
184
+ render : function ( data , type , full , meta ) {
185
+ return formatDuration ( data ) ;
186
+ }
187
+ } ,
188
+ {
189
+ data : 'expected_duration' ,
190
+ render : function ( data , type , full , meta ) {
191
+ return formatDuration ( data ) ;
192
+ }
193
+ }
149
194
] ,
150
195
dom : 't' ,
151
196
language : {
0 commit comments