rating.badge_with_orgs (view)
|
This is a database view, not a base table. It has no triggers, indexes, or FK constraints of its own. Querying this view may be more efficient than joining the underlying tables directly. |
Columns
| Column | Type | Nullable | Notes |
|---|---|---|---|
id |
|
Yes |
|
name |
|
Yes |
|
description |
|
Yes |
|
scope |
|
Yes |
|
weight |
|
Yes |
|
horizon_age |
|
Yes |
|
importance_age |
|
Yes |
|
importance_interval |
|
Yes |
|
importance_scale |
|
Yes |
|
recalc_interval |
|
Yes |
|
attr_filter |
|
Yes |
|
src_filter |
|
Yes |
|
circ_mod_filter |
|
Yes |
|
loc_grp_filter |
|
Yes |
|
popularity_parameter |
|
Yes |
|
fixed_rating |
|
Yes |
|
percentile |
|
Yes |
|
discard |
|
Yes |
|
last_calc |
|
Yes |
|
orgs |
|
Yes |
View Definition
WITH org_scope AS (
SELECT x.id,
array_agg(x.tree) AS orgs
FROM ( SELECT org_unit.id,
(actor.org_unit_descendants(org_unit.id)).id AS tree
FROM actor.org_unit) x
GROUP BY x.id
)
SELECT b.id,
b.name,
b.description,
b.scope,
b.weight,
b.horizon_age,
b.importance_age,
b.importance_interval,
b.importance_scale,
b.recalc_interval,
b.attr_filter,
b.src_filter,
b.circ_mod_filter,
b.loc_grp_filter,
b.popularity_parameter,
b.fixed_rating,
b.percentile,
b.discard,
b.last_calc,
s.orgs
FROM rating.badge b
JOIN org_scope s ON b.scope = s.id;