View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
19899Bug reportsSurvey editingpublic2025-01-07 08:13
ReporterDenisChenu Assigned Togabrieljenik  
PrioritynoneSeverityminor 
Status assignedResolutionopen 
Product Version6.6.x 
Summary19899: Order of question when copying are bad
Description

When set order of question when copying : order are badly set

Steps To Reproduce

Steps to reproduce

Get a survey
Copy a question
Put the order just after 1st question
Savec

Expected result

New question are after 1st question

Actual result

New question after 2nd question (but sometimes it's OK)

TagsNo tags attached.
Attached Files
Bug heat4
Complete LimeSurvey version number (& build)6.8.2
I will donate to the project if issue is resolvedNo
Browsernot relevant
Database type & versionmariadb
Server OS (if known)debian
Webserver software & version (if known)nginx
PHP Version8.3.14

Relationships

related to 19900 new Unable to set position (in group) of new question 

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2024-12-19 12:09

developer   ~81664

Last edited: 2024-12-19 12:09

@gabrieljenik
I do a quick fix for 5.X : https://github.com/SondagesPro/LimeSurvey-SondagesPro/commit/238735c6066d279da89d5710410526a763823c8a

But i think it must be in https://github.com/LimeSurvey/LimeSurvey/blob/master/application/models/services/CopyQuestion.php

gabrieljenik

gabrieljenik

2025-01-06 17:22

manager   ~81745

So before inserting the new question we may need to update the positions of certain questions.
So dilema is where should that be done...?

I don't incline to do it in the CopyQuestion service, as to try to keep the service objective clear and narrow.
Maybe create a new service (could be reusable on other scnearios as importing questions or creating new questions or RC?

In fact, if talking about updating the service, I think there are things that would be good to correct in the service. For example, it would be good if instead of making queries like \Question::model()->findAllByAttributes(['parent_qid' => $parentId]); you could use the relationships of $this->copyQuestionValues->getQuestiontoCopy(). This way it is limited to what you are passing as parameters.

DenisChenu

DenisChenu

2025-01-07 08:12

developer   ~81746

I don't incline to do it in the CopyQuestion service, as to try to keep the service objective clear and narrow.

Order are related to CopyQuestion (and Create question too, see related : 19900: Unable to set position (in group) of new question).

If you think we can keep it in Question::increaseAllOrderNumbersForGroup : i can apply same fix for master.

DenisChenu

DenisChenu

2025-01-07 08:13

developer   ~81747

PS : i think we don't need a CopyQuestion service, or better : we need a lighter CopyQuestion using a NewQuestion service

Issue History

Date Modified Username Field Change
2024-12-17 16:19 DenisChenu New Issue
2024-12-17 16:19 DenisChenu File Added: Capture vidéo du 2024-12-17 16-16-47.webm
2024-12-19 11:38 tibor.pacalat Assigned To => gabrieljenik
2024-12-19 11:38 tibor.pacalat Status new => assigned
2024-12-19 12:09 DenisChenu Note Added: 81664
2024-12-19 12:09 DenisChenu Bug heat 0 => 2
2024-12-19 12:09 DenisChenu Note Edited: 81664
2025-01-06 17:22 gabrieljenik Note Added: 81745
2025-01-06 17:22 gabrieljenik Bug heat 2 => 4
2025-01-07 08:11 DenisChenu Relationship added related to 19900
2025-01-07 08:12 DenisChenu Note Added: 81746
2025-01-07 08:13 DenisChenu Note Added: 81747