Browse Source

Instrument collection_start_year

pull/595/head
Stéphane Meny 3 years ago
parent
commit
3c5537f2ab
No known key found for this signature in database
GPG Key ID: 9D0AFEA988527923
  1. 2
      app/controllers/form_controller.rb
  2. 5
      app/models/case_log.rb

2
app/controllers/form_controller.rb

@ -4,7 +4,6 @@ class FormController < ApplicationController
before_action :find_resource_by_named_id, except: %i[submit_form review]
def submit_form
transaction = Sentry.start_transaction(op: "submit_form")
if @case_log
@page = @case_log.form.get_page(params[:case_log][:page])
responses_for_page = responses_for_page(@page)
@ -24,7 +23,6 @@ class FormController < ApplicationController
else
render_not_found
end
transaction.finish if transaction
end
def check_answers

5
app/models/case_log.rb

@ -66,10 +66,13 @@ class CaseLog < ApplicationRecord
end
def collection_start_year
transaction = Sentry.start_transaction(op: "collection_start_year")
return unless startdate
window_end_date = Time.zone.local(startdate.year, 4, 1)
startdate < window_end_date ? startdate.year - 1 : startdate.year
start_year = startdate < window_end_date ? startdate.year - 1 : startdate.year
transaction.finish if transaction
start_year
end
def form_name

Loading…
Cancel
Save