Skip to content

Commit

Permalink
Add data quality to table display
Browse files Browse the repository at this point in the history
  • Loading branch information
hunchr committed Aug 19, 2024
1 parent 8eaeb0f commit 3df112c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/domain/table_displays/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Resolver
wiedereintritt: :show,
self_registration_reason: :show_full,
address_valid: :show,
data_quality: :show,
sac_remark_national_office: :manage_national_office_remark,
sac_remark_section_1: :manage_section_remarks,
sac_remark_section_2: :manage_section_remarks,
Expand Down
14 changes: 14 additions & 0 deletions app/helpers/sac_cas/people_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def people_sac_membership_qr_code(person, html_options = {})
end
end

def format_person_data_quality(person)
format_data_quality_icons(person.data_quality)
end

private

def people_sac_membership_qr_code_clickable(verification_qr_code, image)
Expand All @@ -44,4 +48,14 @@ def people_sac_membership_qr_code_clickable(verification_qr_code, image)
image
end
end

def format_data_quality_icons(status)
icons = {
ok: "check-circle",
info: "info-circle",
warning: "exclamation-triangle",
error: "times-circle"
}
icon(icons[status.to_sym], title: I18n.t("people.data_quality.#{status}"))
end
end
7 changes: 7 additions & 0 deletions config/locales/wagon.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ de:
sac_remark_section_3: Bemerkungen Sektion 3
sac_remark_section_4: Bemerkungen Sektion 4
sac_remark_section_5: Bemerkungen Sektion 5
data_quality: Datenqualität
correspondences:
digital: Digital
print: Physisch
Expand Down Expand Up @@ -1153,6 +1154,12 @@ de:
sac_remarks: Bemerkungen
external_invoices: Rechnungen

data_quality:
ok: OK
info: Info
warning: Warnung
error: Fehler

show_right_z_sac_cas:
section_sac_membership: SAC Mitgliedschaft
qr_code_hint: Scannen um Mitgliedschaft zu verifizieren
Expand Down
1 change: 1 addition & 0 deletions lib/hitobito_sac_cas/wagon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class Wagon < Rails::Engine
:wiedereintritt,
:self_registration_reason,
:address_valid,
:data_quality,
:sac_remark_national_office,
:sac_remark_section_1,
:sac_remark_section_2,
Expand Down
11 changes: 11 additions & 0 deletions spec/domain/table_displays/resolving_column_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@
let(:person) { people(:admin).tap { |p| allow(p).to receive(:membership_years).and_return(3) } }
end

it_behaves_like "table display", {
column: :data_quality,
header: "Datenqualität",
value: "", # is icon
permission: :show
} do
let(:person) do
people(:admin).tap { |p| allow(p).to receive(:data_quality).and_return("info") }
end
end

it_behaves_like "table display", {
column: :sac_remark_national_office,
header: "Bemerkungen Geschäftsstelle",
Expand Down

0 comments on commit 3df112c

Please sign in to comment.