app/models/email_submissions_audit.rb
# Note: reference is the email reference, and starts with prefix
# `user` or `court`, followed by the application reference code.
# Refer to `mailers/notify_submission_mailer.rb`
#
# Email is optional. If not provided, all records matching the
# `reference` will be returned. Otherwise it will return only the
# records matching the exact reference and email (email is hashed).
#
# :nocov:
reference is the email reference, and starts with prefix
`user` or `court`, followed by the application reference code.

Email is optional. If not provided, all records matching the
`reference` will be returned. Otherwise it will return only the
records matching the exact reference and email (email is hashed).

:nocov.
reference is the email reference and starts with prefix ` user ` or ` court ` followed by the application reference code . Email is optional . If not provided all records matching the ` reference ` will be returned . Otherwise it will return only the records matching the exact reference and email ( email is hashed ) . : nocov .
def find_records(reference, email = nil)
      EmailSubmissionsAudit.where(reference: %W[user;#{reference} court;#{reference}]).select do |record|
        email.blank? || BCrypt::Password.new(record.to) == email
      end
    end
def find_records ( reference , email = nil ) EmailSubmissionsAudit . where ( reference : %W[ user; #{ reference } court; #{ reference } ] ) . select do | record | email . blank? || BCrypt :: Password . new ( record . to ) == email end end
Note: reference is the email reference, and starts with prefix
`user` or `court`, followed by the application reference code.
Note : reference is the email reference and starts with prefix ` user ` or ` court ` followed by the application reference code .
reference
email