mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Add an OFN UID column to the Users & Enterprises report
This commit is contained in:
committed by
Konrad
parent
e065910d2d
commit
40b0bfb433
@@ -2870,6 +2870,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
report_filters: Report Filters
|
||||
report_print: Print Report
|
||||
report_render_options: Rendering Options
|
||||
report_header_ofn_uid: OFN UID
|
||||
report_header_order_cycle: Order Cycle
|
||||
report_header_user: User
|
||||
report_header_email: Email
|
||||
|
||||
@@ -16,7 +16,8 @@ module Reporting
|
||||
is_producer: proc { |x| x.is_primary_producer },
|
||||
sells: proc { |x| x.sells },
|
||||
visible: proc { |x| x.visible },
|
||||
confirmation_date: proc { |x| x.created_at }
|
||||
confirmation_date: proc { |x| x.created_at },
|
||||
ofn_uid: proc { |x| x.ofn_uid }
|
||||
}
|
||||
end
|
||||
|
||||
@@ -46,7 +47,8 @@ module Reporting
|
||||
|
||||
def query_helper(query, email_user, relationship_type)
|
||||
query.order("enterprises.created_at DESC")
|
||||
.select(["enterprises.name",
|
||||
.select(["enterprises.id AS ofn_uid",
|
||||
"enterprises.name",
|
||||
"enterprises.sells",
|
||||
"enterprises.visible",
|
||||
"enterprises.is_primary_producer",
|
||||
|
||||
53
spec/system/admin/reports/users_and_enterprises_spec.rb
Normal file
53
spec/system/admin/reports/users_and_enterprises_spec.rb
Normal file
@@ -0,0 +1,53 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'system_helper'
|
||||
|
||||
describe "Users & Enterprises reports" do
|
||||
include AuthenticationHelper
|
||||
|
||||
let!(:enterprise) { create(:supplier_enterprise) }
|
||||
|
||||
before do
|
||||
login_as_admin
|
||||
visit main_app.admin_report_path(report_type: 'users_and_enterprises')
|
||||
end
|
||||
|
||||
it "displays the report" do
|
||||
find("[type='submit']").click
|
||||
|
||||
expect(page.find("table.report__table thead tr").text).to have_content([
|
||||
"USER",
|
||||
"RELATIONSHIP",
|
||||
"ENTERPRISE",
|
||||
"PRODUCER?",
|
||||
"SELLS",
|
||||
"VISIBLE",
|
||||
"CONFIRMATION DATE",
|
||||
"OFN UID"
|
||||
].join(" "))
|
||||
|
||||
row_i, row_ii = page.all("table.report__table tbody tr").map(&:text)
|
||||
|
||||
expect(row_i).to have_content([
|
||||
enterprise.owner.email,
|
||||
"owns",
|
||||
enterprise.name,
|
||||
"Yes",
|
||||
"none",
|
||||
"public",
|
||||
enterprise.created_at.strftime("%Y-%m-%d %H:%M"),
|
||||
enterprise.id
|
||||
].compact.join(" "))
|
||||
|
||||
expect(row_ii).to have_content([
|
||||
enterprise.owner.email,
|
||||
"manages",
|
||||
enterprise.name,
|
||||
"Yes",
|
||||
"none",
|
||||
"public",
|
||||
enterprise.created_at.strftime("%Y-%m-%d %H:%M"),
|
||||
enterprise.id
|
||||
].compact.join(" "))
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user