corrected views to accept empty values

This commit is contained in:
Jörg Henke
2023-10-17 11:20:53 +02:00
parent 558ff9ce03
commit 921c9e9a0b

View File

@ -40,7 +40,7 @@ create table done.t_done (
create view done.v_billing as
with x(total) as (
select count(1) as count
select coalesce(nullif(count(1), 0), 1) as count
from done.t_done
) select b.pk, b.name, b.shortcut, b.csskey,
round(((count(db.*)::double precision / x.total::double precision) * 100::double precision)::numeric, 2) AS percent_usage
@ -137,7 +137,7 @@ order by login, workday, project_name, module_name, job_name;
create view done.v_job as
with x(total) as (
select count(1) as count
select coalesce(nullif(count(1), 0), 1) as count
from done.t_done
) select j.pk, j.name,
round(((count(dj.*)::double precision / x.total::double precision) * 100::double precision)::numeric, 2) as percent_usage
@ -149,7 +149,7 @@ with x(total) as (
create view done.v_module as
with x(total) as (
select count(1) as count
select coalesce(nullif(count(1), 0), 1) as count
from done.t_done
) select m.pk, m.name,
round(((count(dm.*)::double precision / x.total::double precision) * 100::double precision)::numeric, 2) as percent_usage
@ -161,7 +161,7 @@ with x(total) as (
create view done.v_project as
with x(total) as (
select count(1) as count
select coalesce(nullif(count(1), 0), 1) as count
from done.t_done
) select p.pk, p.name,
round(((count(dp.*)::double precision / x.total::double precision) * 100::double precision)::numeric, 2) as percent_usage