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> --> </p> -->
</div> </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 }} {{ created_at }}
</div> </div>
@ -105,7 +106,7 @@
<p v-if="message.binding">Binding: <span class="font-thin">{{ message.binding }}</span></p> <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.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.seed">Seed: <span class="font-thin">{{ message.seed }}</span></p>
<p v-if="message.time_spent">Time spent: <span class="font-thin" <p v-if="time_spent">Time spent: <span class="font-thin"
:title="'Finished generating: ' + finished_generating_at_parsed">{{ time_spent }}</span></p> :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 startTime = new Date(Date.parse(this.message.created_at))
const endTime = new Date(Date.parse(this.message.finished_generating_at)) const endTime = new Date(Date.parse(this.message.finished_generating_at))
//const spentTime = new Date(endTime - startTime) //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(); let timeDiff = endTime.getTime() - startTime.getTime();
const hours = Math.floor(timeDiff / (1000 * 60 * 60)); const hours = Math.floor(timeDiff / (1000 * 60 * 60));
timeDiff -= hours * (1000 * 60 * 60); timeDiff -= hours * (1000 * 60 * 60);
@ -356,12 +365,8 @@ export default {
// let s = addZero(spentTime.getSeconds()); // let s = addZero(spentTime.getSeconds());
const time = addZero(hours) + "h:" + addZero(mins) + "m:" + addZero(secs) + 's'; const time = addZero(hours) + "h:" + addZero(mins) + "m:" + addZero(secs) + 's';
if (timeDiff==0){
console.log(timeDiff)
return undefined
}else{
return time return time
}
} }

View File

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