Aug 7 - Update: add external inspector
This commit is contained in:
@@ -10,6 +10,14 @@ role_key values
|
||||
admin — all users with role='admin'
|
||||
director — all users with role='director'
|
||||
inspector — all users with role='inspector'
|
||||
EXCEPTION: for event 'inspection_completed', the inspector
|
||||
column notifies ONLY the inspection's own inspector
|
||||
(the submitter), not the whole inspector pool. Scoping is
|
||||
applied in notify_by_matrix() via the inspection_id.
|
||||
external_inspector — all users with role='external_inspector' (customer /
|
||||
third-party inspectors). Separate column so third parties
|
||||
can be routed differently from the tenant's own crew; the
|
||||
'inspection_completed' scoping above applies here too.
|
||||
project_manager — all users with role='project_manager'
|
||||
customer — all customer-portal users assigned to the relevant facility
|
||||
assignee — the specific user the issue/inspection is assigned to
|
||||
@@ -40,6 +48,7 @@ MATRIX_ROLES = [
|
||||
('admin', 'Admin'),
|
||||
('director', 'Director'),
|
||||
('inspector', 'Inspector'),
|
||||
('external_inspector', 'External Inspector'),
|
||||
('project_manager', 'Project Manager'),
|
||||
('auditor', 'Auditor'),
|
||||
('customer', 'Customer'),
|
||||
@@ -171,6 +180,18 @@ MATRIX_DEFAULTS = {
|
||||
('score_alert', 'custom'): False,
|
||||
}
|
||||
|
||||
# MT-15 — the External Inspector column defaults to whatever the internal
|
||||
# Inspector column defaults to, for every event. Mirroring rather than listing
|
||||
# 14 more literals means a future event added for 'inspector' automatically
|
||||
# gets a matching external default instead of silently falling back to the
|
||||
# is_enabled() fallback. Admins can diverge the two columns in the UI at any
|
||||
# time; this only seeds rows that do not exist yet.
|
||||
MATRIX_DEFAULTS.update({
|
||||
(_event, 'external_inspector'): _enabled
|
||||
for (_event, _role), _enabled in list(MATRIX_DEFAULTS.items())
|
||||
if _role == 'inspector'
|
||||
})
|
||||
|
||||
|
||||
class NotificationMatrix(db.Model):
|
||||
"""Admin-controlled per-event notification routing."""
|
||||
|
||||
Reference in New Issue
Block a user