You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
somehow one of our user succeeded to create 2 answers for a single question in a plan.
this breaks the plan's copy function:
Dec 8 10:52:11 dmponline 3a8bd47f98a0[1303]: I, [2023-12-08T09:52:11.782437 #15] INFO -- : [5e05df68-bcef-4f12-bc35-3b34991b9bbf] Started POST "/plans/199459/duplicate" for 157.193.240.160 at 2023-12-08 09:52:11 +0000
Dec 8 10:52:11 dmponline 3a8bd47f98a0[1303]: I, [2023-12-08T09:52:11.784958 #15] INFO -- : [5e05df68-bcef-4f12-bc35-3b34991b9bbf] Processing by PlansController#duplicate as HTML
Dec 8 10:52:11 dmponline 3a8bd47f98a0[1303]: I, [2023-12-08T09:52:11.785160 #15] INFO -- : [5e05df68-bcef-4f12-bc35-3b34991b9bbf] Parameters: {"authenticity_token"=>"cfC9t2wOlntTWDQ3c+y42wT9M47IVcUtwjFkRLY17Oi2iwEzZY03ZOhQqfZMPUaVmYWC/iUE4kSf0rIZSNN9lQ==", "id"=>"199459"}
Dec 8 10:52:13 dmponline 3a8bd47f98a0[1303]: I, [2023-12-08T09:52:13.707091 #15] INFO -- : [5e05df68-bcef-4f12-bc35-3b34991b9bbf] Completed 422 Unprocessable Entity in 1922ms (ActiveRecord: 834.5ms)
Dec 8 10:52:13 dmponline 3a8bd47f98a0[1303]: F, [2023-12-08T09:52:13.707742 #15] FATAL -- : [5e05df68-bcef-4f12-bc35-3b34991b9bbf]
Dec 8 10:52:13 dmponline 3a8bd47f98a0[1303]: F, [2023-12-08T09:52:13.707790 #15] FATAL -- : [5e05df68-bcef-4f12-bc35-3b34991b9bbf] ActiveRecord::RecordInvalid (Validation failed: Question must be unique):
Dec 8 10:52:13 dmponline 3a8bd47f98a0[1303]: F, [2023-12-08T09:52:13.707816 #15] FATAL -- : [5e05df68-bcef-4f12-bc35-3b34991b9bbf]
Dec 8 10:52:13 dmponline 3a8bd47f98a0[1303]: F, [2023-12-08T09:52:13.707841 #15] FATAL -- : [5e05df68-bcef-4f12-bc35-3b34991b9bbf] app/models/plan.rb:255:in `block in deep_copy'
Dec 8 10:52:13 dmponline 3a8bd47f98a0[1303]: [5e05df68-bcef-4f12-bc35-3b34991b9bbf] app/models/plan.rb:252:in `deep_copy'
Dec 8 10:52:13 dmponline 3a8bd47f98a0[1303]: [5e05df68-bcef-4f12-bc35-3b34991b9bbf] app/controllers/plans_controller.rb:389:in `duplicate'
After some investigation, we've found the offending entries:
dmponline_production=# select * from roadmap_production.answers where plan_id=199459 and question_id=304161 order by question_id;
1854143 | | 199459 | 18161 | 304161 | 2023-05-09 16:53:39+02 | 2023-05-09 16:53:39+02 | 1
1854144 | | 199459 | 18161 | 304161 | 2023-05-09 16:53:39+02 | 2023-05-09 16:53:39+02 | 1
deleting one of them solved the issue:
dmponline_production=# delete from roadmap_production.answers_question_options where answer_id=1854144;
DELETE 1
dmponline_production=# delete from roadmap_production.answers where id=1854144;
DELETE 1
dmponline_production=#
That would be good to put a unicity constraint on the (plan_id,question_id) tulpe on the answers table
The text was updated successfully, but these errors were encountered:
somehow one of our user succeeded to create 2 answers for a single question in a plan.
this breaks the plan's copy function:
After some investigation, we've found the offending entries:
deleting one of them solved the issue:
That would be good to put a unicity constraint on the (plan_id,question_id) tulpe on the answers table
The text was updated successfully, but these errors were encountered: