Skip to content
Snippets Groups Projects
Commit a64c0b48 authored by Anusha Ranganathan's avatar Anusha Ranganathan
Browse files

Refactored code

parent 7721a653
No related tags found
1 merge request!368Improve agreement date check
Pipeline #19623 passed
......@@ -230,13 +230,11 @@ class User < ApplicationRecord
end
def agreement_accepted?
if ContentBlock.for(:terms)&.updated_at.present?
agreement_date = ContentBlock.for(:terms)&.updated_at
elsif ContentBlock.for(:terms)&.created_at.present?
agreement_date = ContentBlock.for(:terms)&.created_at
else
agreement_date = DateTime.parse(ENV.fetch("DEFAULT_AGREEMENT_DATE", "2024-01-01"))
end
term_of_uses = ContentBlock.for(:terms)
default_agreement_date = DateTime.parse(ENV.fetch("DEFAULT_AGREEMENT_DATE", "2024-01-01"))
agreement_date = term_of_uses&.updated_at || term_of_uses&.created_at || default_agreement_date
agreement_accepted_at && (agreement_accepted_at > agreement_date)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment