View Issue Details

IDProjectCategoryView StatusLast Update
15861Bug reports[All Projects] _ Unknownpublic2020-02-17 11:22
Reporterollehar Assigned ToDenisChenu  
PrioritynormalSeverityblock 
Status closedResolutionfixed 
Product Version4.1.2 
Target Version4.0.xFixed in Version 
Summary15861: Stat function tests break on postgres
Description

Title. Run test on postgres. See discussion on github: https://github.com/LimeSurvey/LimeSurvey/commit/ee4f06983913e5b4af2f6d8d6d9d6d7e4d2efbaf

Steps To Reproduce

Run funcional test suite on postgres.

TagsNo tags attached.
Complete LimeSurvey version number (& build)latest master
I will donate to the project if issue is resolvedNo
Browser-
Database & DB-Versionpostgres 12
Server OS (if known)-
Webserver software & version (if known)-
PHP Version-

Activities

DenisChenu

DenisChenu

2020-02-13 12:02

developer   ~55942

@ollehar : i don't have my destop currently, then for testing in PG : more complex

I think i use

 if(Yii::app()->db->driverName == 'pgsql') { 
     $castedColumnString = "CAST($sColumn as text)"; 
 } 

But alternat is checking DB coluln type.

What is your opinion on the best choice ?

ollehar

ollehar

2020-02-13 12:10

administrator   ~55943

I still think the best option is to compare with 0 or use IS NOT NULL. Or if not possible, switch on question type, I guess.

ollehar

ollehar

2020-02-13 12:11

administrator   ~55944

Btw, fixing this bug is part of putting postgres into Travis. Just have to make sure the test suite works first. :)

ollehar

ollehar

2020-02-13 13:35

administrator   ~55945

: i don't have my destop currently, then for testing in PG : more complex

No docker? Booo.

DenisChenu

DenisChenu

2020-02-13 13:37

developer   ~55946

Docker on my desktop ... not on my 8 years old laptop ...

DenisChenu

DenisChenu

2020-02-13 13:40

developer   ~55947

I still think the best option is to compare with 0

non, no and again no ....
See https://github.com/LimeSurvey/LimeSurvey/commit/ee4f06983913e5b4af2f6d8d6d9d6d7e4d2efbaf#diff-e1a49c510280877fd0e9cbde94631758R47
«Count previous response done not empty»

Compare with Expression Manager count :

  1. count(Q1) == 0 if Q1 is a short text and are empty
  2. count(Q1) == 2 if Q1 is a number and are 0
ollehar

ollehar

2020-02-13 13:47

administrator   ~55948

OK, then switch on question type, I guess, since different question types encode "not answered" or "empty answer" differently.

But numerical question cannot store "empty answer", right?

DenisChenu

DenisChenu

2020-02-13 13:49

developer   ~55949

numerical and date : set to null if not answered : this is an issue in some situation.

ollehar

ollehar

2020-02-13 13:52

administrator   ~55950

Last edited: 2020-02-13 13:52

View 2 revisions

But "not answered" != "empty answer", because "not answered" can be "not seen"?
Bah. Whatever.

DenisChenu

DenisChenu

2020-02-13 14:07

developer   ~55951

Not seen : IS NULL
Not answered (for text and choice) : = ''

You use LimeSurvey sometimes ?

ollehar

ollehar

2020-02-13 14:19

administrator   ~55952

No, I never use LimeSurvey. Obviously, when would I have time? :)

Not answered (for text and choice) : = ''

I was wondering about "not answered" for numerical questions. Also null?

DenisChenu

DenisChenu

2020-02-13 14:28

developer   ~55953

https://gitlab.com/SondagesPro/ExportAndStats/exportCompleteAnswers/-/blob/master/exportCompleteAnswers.php#L93

This settings use code before and after under condition, default adding the string if user see the question (except for numerical and date question)

And here ; https://www.limesurvey.org/forum/team-only/118894-harmonizing-missing-values-in-dataset-null-vs-empty-vs-distinct-values?start=15#187151

Triple-s export already have a solution for non numeric and non date columns :
No clean solution to know a question his hidden or not for numeric and date (only heavy hack solution)

ollehar

ollehar

2020-02-13 14:29

administrator   ~55954

Got it. Then, just another query for numeric and date questions.

DenisChenu

DenisChenu

2020-02-13 16:09

developer   ~55970

Arg ....
https://www.yiiframework.com/doc/api/1.1/CDbColumnSchema#type-detail

return string for decimal and datetime ...

I check for dbType but hope it's not RAW type ...

ollehar

ollehar

2020-02-13 16:10

administrator   ~55972

No free lunch...

DenisChenu

DenisChenu

2020-02-13 16:17

developer   ~55975

With mysql : return DB name ... int(11) for _filecount for example ...

DenisChenu

DenisChenu

2020-02-13 17:05

developer   ~55976

https://github.com/LimeSurvey/LimeSurvey/pull/1388

ollehar

ollehar

2020-02-13 17:05

administrator   ~55977

Thanks, will test later.

DenisChenu

DenisChenu

2020-02-13 17:05

developer   ~55978

I don't know if i set to testing ? I set to another dev ? etc ...

ollehar

ollehar

2020-02-13 17:06

administrator   ~55980

Setting to testing is good, and also write a comment to bump it.

DenisChenu

DenisChenu

2020-02-14 11:17

developer   ~56008

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=29559

lime_release_bot

lime_release_bot

2020-02-17 11:22

administrator   ~56047

Fixed in Release 4.1.5+200217

Related Changesets

LimeSurvey: master 24f8b448

2020-02-14 11:16:59

DenisChenu


Committer: GitHub Details Diff
Fixed issue 15861: Stat function tests break on postgres (#1388)

Dev: usage of CAST only for pgsql
Dev: find DB type return RAW dbType : can change on SQL version udate
Affected Issues
15861
mod - application/core/plugins/statFunctions/config.xml Diff File
mod - application/core/plugins/statFunctions/countFunctions.php Diff File
mod - application/core/plugins/statFunctions/statFunctions.php Diff File

Issue History

Date Modified Username Field Change
2020-02-13 11:57 ollehar New Issue
2020-02-13 11:57 ollehar Status new => assigned
2020-02-13 11:57 ollehar Assigned To => DenisChenu
2020-02-13 11:57 ollehar Priority none => normal
2020-02-13 12:02 DenisChenu Note Added: 55942
2020-02-13 12:10 ollehar Note Added: 55943
2020-02-13 12:11 ollehar Note Added: 55944
2020-02-13 13:35 ollehar Note Added: 55945
2020-02-13 13:37 DenisChenu Note Added: 55946
2020-02-13 13:40 DenisChenu Note Added: 55947
2020-02-13 13:47 ollehar Note Added: 55948
2020-02-13 13:49 DenisChenu Note Added: 55949
2020-02-13 13:52 ollehar Note Added: 55950
2020-02-13 13:52 ollehar Note Edited: 55950 View Revisions
2020-02-13 14:07 DenisChenu Note Added: 55951
2020-02-13 14:19 ollehar Note Added: 55952
2020-02-13 14:28 DenisChenu Note Added: 55953
2020-02-13 14:29 ollehar Note Added: 55954
2020-02-13 16:09 DenisChenu Note Added: 55970
2020-02-13 16:10 ollehar Note Added: 55972
2020-02-13 16:17 DenisChenu Note Added: 55975
2020-02-13 17:05 DenisChenu Status assigned => testing
2020-02-13 17:05 DenisChenu Note Added: 55976
2020-02-13 17:05 ollehar Note Added: 55977
2020-02-13 17:05 DenisChenu Note Added: 55978
2020-02-13 17:06 ollehar Note Added: 55980
2020-02-14 11:17 DenisChenu Changeset attached => LimeSurvey master 24f8b448
2020-02-14 11:17 DenisChenu Note Added: 56008
2020-02-14 11:17 DenisChenu Resolution open => fixed
2020-02-14 11:32 ollehar Status testing => resolved
2020-02-17 11:22 lime_release_bot Note Added: 56047
2020-02-17 11:22 lime_release_bot Status resolved => closed