Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GO-141 Do not inform user about message_draft diff in validations #487

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions app/jobs/fs/validate_message_draft_result_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,21 @@ def perform(message_draft, location_header, fs_client: FsEnvironment.fs_client)
message_draft.metadata[:validation_errors] = {
result: response[:body]['result'],
errors: response[:body]['problems']&.select { |problem| problem['level'] == 'error' }&.map{ |problem| problem['message'] },
warnings: response[:body]['problems']&.select { |problem| problem['level'] == 'warning' }&.map{ |problem| problem['message'] }
warnings: response[:body]['problems']&.select { |problem| problem['level'] == 'warning' }&.map{ |problem| problem['message'] },
}
message_draft.add_cascading_tag(message_draft.tenant.submission_error_tag)

diff = response[:body]['problems']&.select { |problem| problem['level'] == 'diff' }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nechceme si ten diff odlozit do metadat radsej ako do logu?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mozeme, ale drafty sa budu mazat po submite & stiahnuti plnohodnotnej spravy

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha, dobra poznamka. Nemali by sme si tie warningy a metadata skopirovat tiez (tak podobne ako tagy). Asi by som cakal, ze ked tam bol nejaky warning tak nechcem aby zmizol.

log("Message draft DIFF: #{diff.map{ |problem| problem['message']}.join(', ')}") if diff.any?

message_draft.add_cascading_tag(message_draft.tenant.submission_error_tag) if message_draft.metadata[:validation_errors][:errors].any? || message_draft.metadata[:validation_errors][:warnings].any?
end

message_draft.save
end

private

def log(message)
Rails.logger.info(message)
end
end
Loading