DMPbelgium / roadmap

5 stars 1 forks source link

plan question uneditable #100

Closed StCyr closed 3 months ago

StCyr commented 3 months ago

What version of the DMPRoadmap code are you running? (e.g. v2.2.0)

https://dmponline.be (before 4.2.0 upgrade)

Steps to reproduce:

  1. Open https://dmponline.be/plans/202427/edit?phase_id=17769 (you must be and editor of the plan)
  2. edit question "22. What is/are the purpose(s) of the data transfer?"
  3. Click on the Save button (do not let the autosaving feature confuse you; it doesn't work)
  4. Reload the page
  5. Confirm your edits weren't saved

Actual behaviour:

(from Teams)

[7/17 8:32 AM] Nicolas Franck (Guest) Cyrille Bollu Hi, we got the message from one of our users of dmponline.be that question with title "Vraag 22" in https://dmponline.be/plans/202427/edit?phase_id=17769 cannot be edited anymore, although she could before. I am not sure what user we are talking about, I just got the message. I cannot investigate this, as I am no editor (super admin rights does not suffice), and that user is not in office at the moment. Maybe you can see more from the command line, or add yourself or me as editor via the command line:

[7/17 10:16 AM] Nicolas Franck (Guest) I just did some investigation (after being added as editor): I can update the question text in place, but when I hit the save button and the page reloads the old text reappears. Do you see anything on your side? Time: 10:15 I think POST https://dmponline.be/answers/create_or_update?question_id=304028 -> that is to look for

StCyr commented 3 months ago

[7/24 11:31 AM] Cyrille Bollu I'm seeing this: Jul 17 10:14:24 dmponline 95d8f5fd577a[1270]: I, [2024-07-17T08:14:24.326513 #82560] INFO -- : [aaf5164a-af8c-4d72-b7d5-801a001ab42a] Started POST "/answers/create_or_update?question_id=304028" for 157.193.59.244 at 2024-07-17 08:14:24 +0000 Jul 17 10:14:24 dmponline 95d8f5fd577a[1270]: I, [2024-07-17T08:14:24.329669 #82560] INFO -- : [aaf5164a-af8c-4d72-b7d5-801a001ab42a] Processing by AnswersController#create_or_update as / Jul 17 10:14:24 dmponline 95d8f5fd577a[1270]: I, [2024-07-17T08:14:24.330172 #82560] INFO -- : [aaf5164a-af8c-4d72-b7d5-801a001ab42a] Parameters: {"authenticity_token"=>"mO5jVzqljnyFDrkqQhvDz9VW_ggh9uzfd5uy4Vur9pzy9NWFFFdmU9YpFxI5nhDErFhVWa6u96ncnW9V_r601Q", "answer"=>{"plan_id"=>"202427", "question_id"=>"304028", "lock_version"=>"1", "text"=>"

Currently there are no plans for sharing the dataset beyond the project team (cfr. question 19). Data transfer would only happen after a reasonable request, and if an informed consent is set up. 

\r\n<div id=\"simple-translate\" class=\"simple-translate-system-theme\">\r\n
\r\n<div class=\"simple-translate-button isShow\" style=\"background-image: url('moz-extension://9ffdc9c7-7608-4f1f-9cc8-7c2f8e436d76/icons/512.png'); height: 22px; width: 22px; top: 74px; left: 130px;\"> 
\r\n<div class=\"simple-translate-panel \" style=\"width: 300px; height: 200px; top: 0px; left: 0px; font-size: 13px;\">\r\n<div class=\"simple-translate-result-wrapper\" style=\"overflow: hidden;\">\r\n<div class=\"simple-translate-move\" draggable=\"true\"> 
\r\n<div class=\"simple-translate-result-contents\">\r\n<p class=\"simple-translate-result\" dir=\"auto\">test

\r\n<p class=\"simple-translate-candidate\" dir=\"auto\"> 

\r\n
\r\n\r\n\r\n\r\n"}, "question_id"=>"304028"} I don't really see anything else in the logs

StCyr commented 3 months ago

[4:00 PM] Nicolas Franck (Guest) I tried to update that question 22 again by adding text "test" even clearing did not help. But I am seeing weird content after that sentence

StCyr commented 3 months ago

[4:13 PM] Nicolas Franck (Guest) even making a copy of that plan results into a crash (via the copy button in my dashboard) maybe that crash report will give you more insight: https://dmponline.be/plans/202427/duplicate

StCyr commented 3 months ago

There are 2 records for this answers:

dmponline_production=# select id,created_at,updated_at,user_id,substring(text,0,100) from roadmap_production.answers where plan_id=202427 and question_id=304028;
   id    |          created_at           |          updated_at           | user_id |                                              substring                                              
---------+-------------------------------+-------------------------------+---------+-----------------------------------------------------------------------------------------------------
 2056971 | 2024-06-28 14:34:03.369792+02 | 2024-06-28 14:34:03.369792+02 |   56171 | <p><strong>Currently there are no plans for sharing the dataset beyond the project team (cfr. quest
 2056972 | 2024-06-28 14:34:03.3752+02   | 2024-06-28 14:34:03.3752+02   |   56171 | <p><strong>Currently there are no plans for sharing the dataset beyond the project team (cfr. quest
(2 rows)
StCyr commented 3 months ago
dmponline_production=# delete from roadmap_production.notes where answer_id=2056971;
DELETE 3
dmponline_production=# delete from roadmap_production.answers where id=2056971;
DELETE 1
nicolasfranck commented 3 months ago

so it probably updates one of them (explains the success response), but then loads the other (older) one.

This leaves the question: when did this happen? What is the edge case in which multiple answers for a question within the same plan..