Project

General

Profile

Bug #2561

SQL error in the Tests tool, Chamilo 1.8.8 alpha-

Added by Ivan Tcholakov over 8 years ago. Updated about 8 years ago.

Status:
Bug resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
18/01/2011
Due date:
% Done:

100%

Estimated time:
Complexity:
Normal
SCRUM pts - complexity:
?

Description

DATABASE ERROR #1064:
 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''TEST   AND te.exe_exo_id = 2   
                    ORDER BY tth.exe_cours_id A' at line 3
QUERY       :
 SELECT firstname as col0, lastname col1, tth.exe_name, tth.exe_result , tth.exe_weighting, tth.exe_date
                    FROM  tth, `chamilo_main`.`user` tu
                    WHERE  tu.user_id=tth.exe_user_id AND tth.exe_cours_id = 'TEST   AND te.exe_exo_id = 2   
                    ORDER BY tth.exe_cours_id ASC, tth.exe_date DESC
FILE        :
 C:\Users\Ivan Tcholakov\workspace\chamilo-classic-test\main\inc\lib\statsUtils.lib.inc.php
LINE        :
 119
FUNCTION    :
 getManyResultsXCol

Files

sql_error_in_tests_tool.png (62.5 KB) sql_error_in_tests_tool.png Ivan Tcholakov, 18/01/2011 00:46
a_different_sql_error.png (54.6 KB) a_different_sql_error.png Ivan Tcholakov, 21/01/2011 18:25
yet_another.png (54 KB) yet_another.png Ivan Tcholakov, 21/01/2011 19:05
a.zip (11.7 KB) a.zip Ivan Tcholakov, 22/01/2011 11:47
results_and_feedback_sql_error.png (72.6 KB) results_and_feedback_sql_error.png Ivan Tcholakov, 04/02/2011 19:13
sql_error_on_sample_test_results_and_feedback.png (65.8 KB) sql_error_on_sample_test_results_and_feedback.png Ivan Tcholakov, 08/02/2011 09:43

History

#1

Updated by Ivan Tcholakov over 8 years ago

  • Assignee deleted (Ivan Tcholakov)

I think, this task is not for me.

exercice/exercise_result.class.php

Check the line 118:

                    WHERE  tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '" . Database :: escape_string($cid) . " $user_id_and '

exercice/exercise.lib.php

Check the line 793:

                    WHERE  tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '" . Database :: escape_string($_cid) . " $user_id_and  $exercise_where

and the line 874:

                    WHERE  tu.user_id=tth.exe_user_id AND tth.exe_cours_id = '" . Database :: escape_string($_cid)." $user_id_and $exercise_where 

#2

Updated by Julio Montoya over 8 years ago

  • Status changed from New to Assigned
  • Assignee set to Julio Montoya

thanks for reporting it

#3

Updated by Julio Montoya over 8 years ago

  • Status changed from Assigned to Needs more info
  • % Done changed from 0 to 50
#4

Updated by Ivan Tcholakov over 8 years ago

After updating the source, I tried the same place (Tests tool, the "Results and feedback" button) and a different SQL error occured:

DATABASE ERROR #1146:
 Table 'chamilo_main.tth' doesn't exist
QUERY       :
 SELECT firstname as col0, lastname col1, tth.exe_name, tth.exe_result , tth.exe_weighting, tth.exe_date
                    FROM  tth, `chamilo_main`.`user` tu
                    WHERE  tu.user_id=tth.exe_user_id AND tth.exe_cours_id = 'TEST'   AND te.exe_exo_id = 2   
                    ORDER BY tth.exe_cours_id ASC, tth.exe_date DESC
FILE        :
 C:\Users\Ivan Tcholakov\workspace\chamilo-classic-test\main\inc\lib\statsUtils.lib.inc.php
LINE        :
 119
FUNCTION    :
 getManyResultsXCol

See the picture too.

#5

Updated by Ivan Tcholakov over 8 years ago

Within the file main/exercice/exercise.lib.php there are the functions and get_count_exam_results() and get_exam_results_data().
Inside it the variable $TBL_TRACK_HOTPOTATOES has not been initialized.
I declared (locally in my sources only) the variable $TBL_TRACK_HOTPOTATOES as global at the beginnig of these functions and I got yet another error:

DATABASE ERROR #1054:
 Unknown column 'te.exe_exo_id' in 'where clause'
QUERY       :
 SELECT firstname as col0, lastname col1, tth.exe_name, tth.exe_result , tth.exe_weighting, tth.exe_date
                    FROM `chamilo_main`.`track_e_hotpotatoes` tth, `chamilo_main`.`user` tu
                    WHERE  tu.user_id=tth.exe_user_id AND tth.exe_cours_id = 'TEST'   AND te.exe_exo_id = 2  
                    ORDER BY tth.exe_cours_id ASC, tth.exe_date DESC
FILE        :
 C:\Users\Ivan Tcholakov\workspace\chamilo-classic-test\main\inc\lib\statsUtils.lib.inc.php
LINE        :
 119
FUNCTION    :
 getManyResultsXCol
#6

Updated by Julio Montoya over 8 years ago

Ivan Tcholakov wrote:

Within the file main/exercice/exercise.lib.php there are the functions and get_count_exam_results() and get_exam_results_data().
Inside it the variable $TBL_TRACK_HOTPOTATOES has not been initialized.
I declared (locally in my sources only) the variable $TBL_TRACK_HOTPOTATOES as global at the beginnig of these functions and I got yet another error:

[...]

hello Ivan, did you have a hotpotatoe file I can use?

#7

Updated by Ivan Tcholakov over 8 years ago

A am attaching a file a.html (compressed). It comes from herodoto, see the tasks #1339, #2560.

#8

Updated by Julio Montoya about 8 years ago

  • Status changed from Needs more info to Bug resolved
  • Assignee deleted (Julio Montoya)
  • % Done changed from 50 to 90

i think there are not more sql errors ?

#9

Updated by Ivan Tcholakov about 8 years ago

The last one still stays - "Unknown column 'te.exe_exo_id' in 'where clause'". On a system switched into testing mode click on the icon "Results and feedback" and you will see the error. I am sending a picture.

#10

Updated by Julio Montoya about 8 years ago

  • Status changed from Bug resolved to Assigned
  • Assignee set to Julio Montoya
  • % Done changed from 90 to 70

Ivan Tcholakov wrote:

The last one still stays - "Unknown column 'te.exe_exo_id' in 'where clause'". On a system switched into testing mode click on the icon "Results and feedback" and you will see the error. I am sending a picture.

thanks, here's the fix, need more test when dealing with gradebook ...

http://code.google.com/p/chamilo/source/detail?r=79e383362219728a673e52764d0a1df140da749d&repo=classic

#11

Updated by Yannick Warnier about 8 years ago

Should I put this one in "Requires testing", or is there still something to do about it?

#12

Updated by Ivan Tcholakov about 8 years ago

I tried the "Results and feedback" icon against the ordinary sample test. This is what I got:

DATABASE ERROR #1054:
 Unknown column 'propagate_neg' in 'field list'
QUERY       :
 SELECT lastname as col0, firstname as col1, ce.title as col2, te.exe_result as exresult , te.exe_weighting as exweight,
                te.exe_date as exdate, te.exe_id as exid, email as exemail, te.start_date as col4, steps_counter as exstep, exe_user_id as excruid,te.exe_duration as exduration, propagate_neg
                FROM `chamilo_TESTCOURSE`.`quiz`  AS ce INNER JOIN `chamilo_main`.`track_e_exercices` AS te ON (te.exe_exo_id = ce.id) INNER JOIN  `chamilo_main`.`user`  AS user ON (user.user_id = exe_user_id)
                WHERE te.status != 'incomplete' AND te.exe_cours_id='TESTCOURSE'     AND te.session_id = 0  AND ce.active <>-1 AND orig_lp_id = 0 AND orig_lp_item_id = 0  AND te.exe_exo_id = 1    ORDER BY col1   LIMIT 0, 20
FILE        :
 C:\xampp\htdocs\chamilo-classic\main\exercice\exercise.lib.php
LINE        :
 939
FUNCTION    :
 get_exam_results_data
#13

Updated by Ivan Tcholakov about 8 years ago

I'll reinstall the system for confirmation about the last error.

#14

Updated by Ivan Tcholakov about 8 years ago

After reinstalling the system the last error disappeared. I can't find more SQL errors here. Only I suspect a missing feature (there is no way for looking at the HotPotatoes results) for which I will open a separate task.

#15

Updated by Ivan Tcholakov about 8 years ago

I opened a new task #2767.

#16

Updated by Julio Montoya about 8 years ago

  • Status changed from Assigned to Needs more info
  • Assignee deleted (Julio Montoya)
  • % Done changed from 70 to 80

waiting for more errors :)

#17

Updated by Ivan Tcholakov about 8 years ago

Yeah, it works! Thank you. :-)

#18

Updated by Yannick Warnier about 8 years ago

  • Target version changed from 1.8.8 alpha to 1.8.8 beta
#19

Updated by Julio Montoya about 8 years ago

  • Status changed from Needs more info to Bug resolved
  • % Done changed from 80 to 100

Also available in: Atom PDF