View Issue Details

IDProjectCategoryView StatusLast Update
14952Bug reports[All Projects] Otherpublic2019-08-27 12:44
ReporterDenisChenu Assigned Toeddylackmann  
PrioritynoneSeverityminor 
Status assignedResolutionopen 
Product Version4.0.0-beta 
Target VersionFixed in Version 
Summary14952: Checkintegrity didn't delete question_l10ns and other
Description

When a question is deleted via checkintegrity : related question language are not deleted

Steps To Reproduce

Import included survey
get the 1st qid , filter in DB question_l10ns for this qid (phpMyAdmin for example)
Launch checkintegrity : 3 times if i remind
reload DB (phpMyAdmin for example)
question_l10ns qid is still there

Additional Information

Same for group, answers and maybe some other. Only defaultvalues is deleted currently

TODO must check fixLanguageConsistency function if there are issue like this one

TagsNo tags attached.
Complete LimeSurvey version number (& build)4.0.0 github 1c4b7e853cbd3956c9aea525922df2a90e7019b2
I will donate to the project if issue is resolvedNo
Browsernot relevant
Database & DB-Versionnot relevant ?
Server OS (if known)not relevant ?
Webserver software & version (if known)not relevant ?
PHP Versionnot relevant ?

Activities

DenisChenu

DenisChenu

2019-05-29 14:02

developer   ~52153

Last edited: 2019-05-29 14:02

View 2 revisions

@dominikvitt : i think i move whole to

DefaultValue::model()->with('question')->deleteAll('question.qid IS NULL');
DefaultValueL10n::model()->with('defaultvalue')->deleteAll('defaultvalue.dvid IS NULL');

Are there any reason to do find + foreach ?

dominikvitt

dominikvitt

2019-05-29 15:04

developer   ~52160

Last edited: 2019-05-29 15:05

View 2 revisions

No, it won't work.
First line would delete all default values where qid is missing, which is correct.
But, second line would leave orphaned DefaultValueL10n rows, because you already deleted default values.

I think best approach is to:

  1. update qid = null for DefaultValue where 'question.qid IS NULL'
  2. delete DefaultValueL10n where DefaultValue.qid is null
  3. delete DefaultValue where DefaultValue.qid is null

In that case foreach loop won't be necessary.

DenisChenu

DenisChenu

2019-08-04 12:33

developer   ~53082

I'm unsure on where to put the function …

Maybe

  1. Create QuestionL10n::fixQuestions($isurveyid); (and AnswerL10n etc …)
  2. This function get all language from survey, and delete all other QuestionL10n
  3. Create SurveyLanguageSetting::fixLanguage($isurveyid)
  4. Call all related function in this function

Currently : import any survey, delete : can import it again … even after fixDataIntegrity …

DenisChenu

DenisChenu

2019-08-04 12:42

developer   ~53083

But more : currently : checkintegrity add "checkbox" for each Question. Did we really need to add checkbox ?
Then we need to add checkbox for each QuestionL10n too ?

Maybe best is

  1. First step add one checkbox for all fix to do : one checkbox for "Delete X questions"
  2. 2nd step delete whole Question using a deleteAll and not a for each …

Issue History

Date Modified Username Field Change
2019-05-29 13:58 DenisChenu New Issue
2019-05-29 13:58 DenisChenu Status new => assigned
2019-05-29 13:58 DenisChenu Assigned To => DenisChenu
2019-05-29 14:02 DenisChenu Note Added: 52153
2019-05-29 14:02 DenisChenu Note Edited: 52153 View Revisions
2019-05-29 15:04 dominikvitt Note Added: 52160
2019-05-29 15:05 dominikvitt Note Edited: 52160 View Revisions
2019-08-04 12:33 DenisChenu Assigned To DenisChenu => dominikvitt
2019-08-04 12:33 DenisChenu Status assigned => feedback
2019-08-04 12:33 DenisChenu Note Added: 53082
2019-08-04 12:42 DenisChenu Note Added: 53083
2019-08-04 12:42 DenisChenu Status feedback => assigned
2019-08-06 10:08 dominikvitt Assigned To dominikvitt => cdorin
2019-08-27 12:44 cdorin Assigned To cdorin => eddylackmann