You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
359 B
18 lines
359 B
2 years ago
|
class BulkUploadErrorSummaryTableComponent < ViewComponent::Base
|
||
|
attr_reader :bulk_upload
|
||
|
|
||
|
def initialize(bulk_upload:)
|
||
|
@bulk_upload = bulk_upload
|
||
|
|
||
|
super
|
||
|
end
|
||
|
|
||
|
def sorted_errors
|
||
|
@sorted_errors ||= bulk_upload
|
||
|
.bulk_upload_errors
|
||
|
.group(:col, :field, :error)
|
||
|
.count
|
||
|
.sort_by { |el| el[0][0].rjust(3, "0") }
|
||
|
end
|
||
|
end
|