Skip to content

Commit

Permalink
fix: durationAvg type
Browse files Browse the repository at this point in the history
relates: #83
  • Loading branch information
Boris Dorofeev authored and nodkz committed Oct 27, 2023
1 parent 2b4f40d commit 61de772
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/types/queue/Queue.durationAvg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function createDurationAvgFC(
opts: Options
): ObjectTypeComposerFieldConfigDefinition<any, any> {
return {
type: 'Int!',
type: 'String!',
args: {
limit: {
type: 'Int',
Expand All @@ -20,15 +20,15 @@ export function createDurationAvgFC(
let amount = 0;
let counter = 0;
if (jobs.length === 0) {
return 0;
return '0';
} else {
for (const job of jobs) {
if (job?.finishedOn && job?.processedOn) {
amount += job.finishedOn - job.processedOn;
counter++;
}
}
return (amount / (counter || 1)).toFixed(0);
return String((amount / (counter || 1)).toFixed(0));
}
},
};
Expand Down

0 comments on commit 61de772

Please sign in to comment.