From 3c5537f2ab66792603e681ee42ff8d3a43a7f5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Meny?= Date: Thu, 19 May 2022 19:04:18 +0100 Subject: [PATCH] Instrument collection_start_year --- app/controllers/form_controller.rb | 2 -- app/models/case_log.rb | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index f95f84667..be15cc1b3 100644 --- a/app/controllers/form_controller.rb +++ b/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 diff --git a/app/models/case_log.rb b/app/models/case_log.rb index a03f377fd..9df999699 100644 --- a/app/models/case_log.rb +++ b/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