fixed time spent

This commit is contained in:
AndzejsP 2023-06-17 16:34:56 +03:00
parent a804e5aac7
commit 0970456793
2 changed files with 18 additions and 13 deletions

View File

@ -19,7 +19,8 @@
</p> -->
</div>
<div class="text-sm text-gray-400 font-thin" v-if="message.created_at" :title="'Created at: '+created_at_parsed">
<div class="text-sm text-gray-400 font-thin" v-if="message.created_at"
:title="'Created at: ' + created_at_parsed">
{{ created_at }}
</div>
@ -105,8 +106,8 @@
<p v-if="message.binding">Binding: <span class="font-thin">{{ message.binding }}</span></p>
<p v-if="message.model">Model: <span class="font-thin">{{ message.model }}</span></p>
<p v-if="message.seed">Seed: <span class="font-thin">{{ message.seed }}</span></p>
<p v-if="message.time_spent">Time spent: <span class="font-thin"
:title="'Finished generating: '+finished_generating_at_parsed">{{ time_spent }}</span></p>
<p v-if="time_spent">Time spent: <span class="font-thin"
:title="'Finished generating: ' + finished_generating_at_parsed">{{ time_spent }}</span></p>
</div>
</div>
@ -323,10 +324,18 @@ export default {
const startTime = new Date(Date.parse(this.message.created_at))
const endTime = new Date(Date.parse(this.message.finished_generating_at))
//const spentTime = new Date(endTime - startTime)
const same = endTime.getTime() === startTime.getTime();
if(same){
return undefined
}
if(!endTime.getTime()){
return undefined
}
let timeDiff = endTime.getTime() - startTime.getTime();
const hours = Math.floor(timeDiff / (1000 * 60 * 60));
timeDiff -= hours * (1000 * 60 * 60);
@ -354,15 +363,11 @@ export default {
// let h = addZero(spentTime.getHours());
// let m = addZero(spentTime.getMinutes());
// let s = addZero(spentTime.getSeconds());
const time = addZero(hours) + "h:" + addZero(mins) + "m:" + addZero(secs)+'s';
if (timeDiff==0){
console.log(timeDiff)
return undefined
}else{
return time
}
const time = addZero(hours) + "h:" + addZero(mins) + "m:" + addZero(secs) + 's';
return time
}
}

View File

@ -967,7 +967,7 @@ export default {
seed= `Seed: ${messageEntry.message.seed}`
}
let time_spent=""
if(messageEntry.time_spent && messageEntry.time_spent>0){
if(messageEntry.time_spent){
time_spent= `\nTime spent: ${messageEntry.time_spent}`
}
let bottomRow = ''