@@ -109,6 +109,10 @@ exports.get_avg_time_per_question = (req, res) => {
109109
110110 if ( count != 0 ) averageTime /= count ;
111111
112+ const minutes = Math . floor ( averageTime ) ;
113+ const seconds = Math . round ( ( averageTime - minutes ) * 60 ) ;
114+ averageTime = minutes + ":" + seconds . toString ( ) . padStart ( 2 , '0' ) ;
115+
112116 respond ( req , res , "Got average time per question" , { averageTime : averageTime } , 200 ) ;
113117 } ) ;
114118}
@@ -199,6 +203,10 @@ exports.get_avg_wait_time_today = (req, res) => {
199203
200204 if ( count != 0 ) avgWaitTime /= count ;
201205
206+ const minutes = Math . floor ( avgWaitTime ) ;
207+ const seconds = Math . round ( ( avgWaitTime - minutes ) * 60 ) ;
208+ avgWaitTime = minutes + ":" + seconds . toString ( ) . padStart ( 2 , '0' ) ;
209+
202210 respond ( req , res , "Got average wait time today" , { avgWaitTime : avgWaitTime } , 200 ) ;
203211 } ) ;
204212}
@@ -292,6 +300,10 @@ exports.get_total_avg_time_per_question = (req, res) => {
292300
293301 if ( count != 0 ) averageTime /= count ;
294302
303+ const minutes = Math . floor ( averageTime ) ;
304+ const seconds = Math . round ( ( averageTime - minutes ) * 60 ) ;
305+ averageTime = minutes + ":" + seconds . toString ( ) . padStart ( 2 , '0' ) ;
306+
295307 respond ( req , res , "Got average time per question" , { averageTime : averageTime } , 200 ) ;
296308 } ) ;
297309}
@@ -320,6 +332,10 @@ exports.get_total_avg_wait_time = (req, res) => {
320332
321333 if ( count != 0 ) avgWaitTime /= count ;
322334
335+ const minutes = Math . floor ( avgWaitTime ) ;
336+ const seconds = Math . round ( ( avgWaitTime - minutes ) * 60 ) ;
337+ avgWaitTime = minutes + ":" + seconds . toString ( ) . padStart ( 2 , '0' ) ;
338+
323339 respond ( req , res , "Got average wait time" , { totalAvgWaitTime : avgWaitTime } , 200 ) ;
324340 } ) ;
325341}
0 commit comments