Skip to content

Commit

Permalink
style(tagstatistics): change format for duration column
Browse files Browse the repository at this point in the history
  • Loading branch information
lucashimpens committed Oct 15, 2024
1 parent 509883c commit 4e92b4e
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions source/src/main/webapp/js/pages/ReportingCampaignStatistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,10 @@ function aoColumnsFunc(tableId) {
"title": doc.getDocLabel("page_campaignstatistics", "avgDuration_col"),
"render": function (data, type, obj) {
let roundedAvgDuration = Math.round(obj.avgDuration);
if (roundedAvgDuration <= 59) {
return `${roundedAvgDuration} s`;
} else {
let minutes = Math.floor(roundedAvgDuration / 60);
let remainingSeconds = roundedAvgDuration % 60;
return `${minutes} min ${remainingSeconds} sec`;
}
let hours = Math.floor(roundedAvgDuration / 3600);
let minutes = Math.floor((roundedAvgDuration % 3600) / 60);
let seconds = roundedAvgDuration % 60;
return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
}
},
{
Expand Down Expand Up @@ -477,13 +474,10 @@ function aoColumnsDetailFunc(tableId) {
"title": doc.getDocLabel("page_campaignstatistics", "avgDuration_col"),
"render": function (data, type, obj) {
let roundedAvgDuration = Math.round(obj.avgDuration);
if (roundedAvgDuration <= 59) {
return `${roundedAvgDuration} s`;
} else {
let minutes = Math.floor(roundedAvgDuration / 60);
let remainingSeconds = roundedAvgDuration % 60;
return `${minutes} min ${remainingSeconds} sec`;
}
let hours = Math.floor(roundedAvgDuration / 3600);
let minutes = Math.floor((roundedAvgDuration % 3600) / 60);
let seconds = roundedAvgDuration % 60;
return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`;
}
},
{
Expand Down

0 comments on commit 4e92b4e

Please sign in to comment.