Skip to content

Commit

Permalink
Coerce
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov committed Jan 26, 2024
1 parent 7c6ba6f commit 477b226
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,8 @@ export class UsageMetricsRepository extends Repository<UsageMetrics> {
(SELECT SUM(count) FROM ${workflowStatsTable} WHERE name IN ('manual_success', 'manual_error')) AS manual_executions_count;
`)) as Row[];

const toNumber = (value: string | number) => {
const num = typeof value === 'number' ? value : parseInt(value, 10);

if (isNaN(num)) return 0;

return num;
};
const toNumber = (value: string | number) =>
(typeof value === 'number' ? value : parseInt(value, 10)) || 0;

return {
enabledUsers: toNumber(enabledUsers),
Expand Down

0 comments on commit 477b226

Please sign in to comment.