You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is an enterprise setting that allows hiding Customer names in report see: Enterprises > Edit > Shop Preferences > Customer Names in Reports.
Currently this done via MaskDataService. It does so by updating the record in memory before rendering the report, this is potentially dangerous, what if the record get accidentally saved ? It is also a bit brittle, depending on how the data is ultimately loaded to render the report, it might just reload the "updated" record, thus not hiding anything.
A better solution is to hide the data at render time.We could use the existing functionality to achieve that:
sigmundpetersen
changed the title
Remove MaskDataService to use hidding on rendering instead.
Remove MaskDataService to use hiding on rendering instead
Jul 4, 2024
What we should change and why (this is tech debt)
There is an enterprise setting that allows hiding Customer names in report see: Enterprises > Edit > Shop Preferences > Customer Names in Reports.
Currently this done via MaskDataService. It does so by updating the record in memory before rendering the report, this is potentially dangerous, what if the record get accidentally saved ? It is also a bit brittle, depending on how the data is ultimately loaded to render the report, it might just reload the "updated" record, thus not hiding anything.
A better solution is to hide the data at render time.We could use the existing functionality to achieve that:
ReportTemplate
has acolumns_format
method :openfoodnetwork/lib/reporting/report_template.rb
Line 62 in 0dd7f26
It's used here in the
ReportRowBuilder
openfoodnetwork/lib/reporting/report_row_builder.rb
Lines 81 to 109 in 0dd7f26
We could implement a "masked" format, which would return "hidden" based on "Customer Names in Reports" setting
The we can just add
collumns_format
in https://github.com/openfoodfoundation/openfoodnetwork/blob/master/lib/reporting/reports/orders_and_distributors/base.rbie:
Context
This came up while fixing this a bug : #12594
Impact and timeline
The text was updated successfully, but these errors were encountered: