Resolve bug where duration of not-started runner cannot be calculated

This commit is contained in:
Sebastian Serth
2022-07-15 00:37:05 +02:00
parent 1183f5cdcd
commit 9587ecb2b1

View File

@ -308,7 +308,11 @@ class SubmissionsController < ApplicationController
end
def send_and_store(client_socket, message)
message[:timestamp] = ActiveSupport::Duration.build(Time.zone.now - @testrun[:starting_time])
message[:timestamp] = if @testrun[:starting_time]
ActiveSupport::Duration.build(Time.zone.now - @testrun[:starting_time])
else
0.seconds
end
@testrun[:messages].push message
@testrun[:status] = message[:status] if message[:status]
client_socket.send_data JSON.dump(message)