From cadb462208dc9f403e6ef69d161444ea14cae109 Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Wed, 15 Jun 2022 15:48:00 +0200 Subject: [PATCH] Fixes #4127 - Webhhok transfers "accounted_time" of an article as integer instead of float/double. --- .../trigger_webhook_job/record_payload/ticket/article.rb | 2 +- .../record_payload/ticket/article_spec.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/jobs/trigger_webhook_job/record_payload/ticket/article.rb b/app/jobs/trigger_webhook_job/record_payload/ticket/article.rb index 4663514a4..9d6568929 100644 --- a/app/jobs/trigger_webhook_job/record_payload/ticket/article.rb +++ b/app/jobs/trigger_webhook_job/record_payload/ticket/article.rb @@ -10,7 +10,7 @@ class TriggerWebhookJob::RecordPayload::Ticket::Article < TriggerWebhookJob::Rec end def add_accounted_time(result) - result['accounted_time'] = record.ticket_time_accounting&.time_unit.to_i + result['accounted_time'] = record.ticket_time_accounting&.time_unit.to_f result end diff --git a/spec/jobs/trigger_webhook_job/record_payload/ticket/article_spec.rb b/spec/jobs/trigger_webhook_job/record_payload/ticket/article_spec.rb index b2018d03d..62ac2554f 100644 --- a/spec/jobs/trigger_webhook_job/record_payload/ticket/article_spec.rb +++ b/spec/jobs/trigger_webhook_job/record_payload/ticket/article_spec.rb @@ -24,6 +24,15 @@ RSpec.describe TriggerWebhookJob::RecordPayload::Ticket::Article do end end + describe 'Webhhok transfers "accounted_time" of an article as integer instead of float/double #4127' do + let(:entry) { create(:ticket_time_accounting, ticket_id: record.ticket.id, ticket_article_id: record.id, time_unit: 3.33) } + + it "stores value as 'accounted_time' key" do + entry + expect(generate['accounted_time']).to eq(3.33) + end + end + context 'when Article has stored attachments' do before do