From 313d7f8408f90c6d4a4e039cbd19e131a7158a3f Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Thu, 2 Jan 2025 13:18:17 +0200 Subject: [PATCH] adjust response --- app/controllers/api/submissions_controller.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/submissions_controller.rb b/app/controllers/api/submissions_controller.rb index cf2d0097..f1b2f99f 100644 --- a/app/controllers/api/submissions_controller.rb +++ b/app/controllers/api/submissions_controller.rb @@ -116,7 +116,19 @@ module Api end end - json = { submitters: json } if request.path.ends_with?('/init') + if request.path.ends_with?('/init') + json = + if submissions.size == 1 + { + id: submissions.first.id, + submitters: json, + expire_at: submissions.first.expire_at, + created_at: submissions.first.created_at + } + else + { submitters: json } + end + end json end