Project

General

Profile

Bug #5780

GRB - Error if you use an image from another course in a test

Added by Hubert Borderiou over 8 years ago. Updated over 8 years ago.

Status:
Bug resolved
Priority:
Normal
Assignee:
Yoselyn Castillo
Category:
Exercises
Target version:
Start date:
28/11/2012
Due date:
% Done:

100%

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

Description

Hi,
I've two course
"My borderiou course" with an image in its document tool which URL is
http://stable.chamilo.org/courses/MYBORDERIOUCOURSE/document/avatar.jpg?cidReq=MYBORDERIOUCOURSE&id_session=0&gidReq=0&rand=3479
or (http://stable.chamilo.org/courses/MYBORDERIOUCOURSE/document/avatar.jpg whatever)

"My borderiou course 2" with a test

I add the image from course 1, in my test in the "My borderiou course 2" course.
When I do the test, I teleport myself to the course "My borderiou course" !
I leaved the test and the course, panic !

It is a usual manipulation, to use an image from another media (Chamilo course or not).

See screencast : http://www.screencast.com/users/hborderi/folders/Jing/media/51a6f4a4-d5a6-444f-baaf-2e0647f99be4


Files

end-test.gif (25 KB) end-test.gif Yoselyn Castillo, 28/12/2012 21:57
drag-drop-result.gif (40.2 KB) drag-drop-result.gif Yoselyn Castillo, 28/12/2012 21:57

Associated revisions

Revision 81a70a9c (diff)
Added by Julio Montoya over 8 years ago

Should fix bug that changes the course id from course to another during an exercise see #5780

Revision 441d8d72 (diff)
Added by Julio Montoya over 8 years ago

Fixing exercise order bug see #5780

Revision 94f43c96 (diff)
Added by Julio Montoya over 8 years ago

Fixing PHP warnings see #5780

History

#1

Updated by Julio Montoya over 8 years ago

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

That's a tricky one, nice screencast too, you should have your own youtube channel

#2

Updated by Yannick Warnier over 8 years ago

I don't understand why this bug reappeared (literally). It had been fixed months ago (for EPSU if I remember well). There should be a filter in the exercise (and course) copy to seek and destroy all links to the previous course. I suppose it's only fixed for the course copy, then?

#3

Updated by Julio Montoya over 8 years ago

  • Status changed from Assigned to Needs testing
  • Assignee deleted (Julio Montoya)
  • % Done changed from 0 to 50

I reproduced the error, I sent a fix for this one (the course id should be added in the form/URL)

#4

Updated by Hubert Borderiou over 8 years ago

  • Status changed from Needs testing to Needs more info

It works fine for doing the test (if you have several questions on your test, see below).
But you cannot reorder the question with the drag'n'drop feature, and you can't end the test if you have only this question in your test.
See screencast
http://screencast.com/t/wikFdgvXslhK

#5

Updated by Yannick Warnier over 8 years ago

  • Category changed from System to Exercises
  • Status changed from Needs more info to Assigned
  • Assignee set to Julio Montoya
  • Priority changed from High to Normal
#6

Updated by Julio Montoya over 8 years ago

  • Status changed from Assigned to Needs testing
  • Assignee deleted (Julio Montoya)

I sent another fix for this one

#7

Updated by Yannick Warnier over 8 years ago

  • Assignee set to Yoselyn Castillo
  • % Done changed from 50 to 70

I'm not really comfortable at all with this change, although I recognize it was made the right way.

For a number of reasons, in Chamilo, we base the reactions of the application on the url parameters as a priority over the session:
  • it ensures you (as an admin) can easily be in two courses at the same time
  • it ensures order, making sure the latest situation is always considered as the most important one
  • it ensures that, even if the session is lost, getting back on your track will enable you to find where you were exactly (as opposed to storing it in the session, in which case you would return to the previous step and be lost on a page with no indication of what course you were in)
    (I'm sure I can find other reasons but these are the first ones that come to mind)

This has the negative impact of loading the server more (because it requires us to check permissions at each page load), but it has the quality of increasing security (because of the same checks).

The problem with this bug report is that a media from another Chamilo course, when used inside an exercise, is loaded after the main page containing it, so it works like this:
  • Chamilo loads the exercise page in the "AAA" course and sets the session data based on the URL (including "_cid = AAA")
  • Chamilo loads the image (coming from "BBB" inside the exercise) and resets the session data based on the URL of this image (including "_cid=BBB")
  • When the user clicks the button (and this is what Julio fixed in his patch, which is right but maybe there will be other ways to get to another exercise step which escaped him this time), the URL was generated without the ID of the course, so it was using the last known ID, which was the ID of BBB
There are other ways we could do this well:
  • make sure that, when loading media from another course (we would have to define "media"), the cidReq is not set in the session.
  • use a central repository that doesn't really need a course ID to show the document or not, but that's kind of a very long shot...

So the conclusion for now is that this seems to work but that we need to watch that every link placed in the exercises tool has the cidReq (or at least the numerical course id).
In any case, the first bug reported was solved and verified. I'm assigning it to Yoselyn to do the verification about the drag & drop.

#8

Updated by Yoselyn Castillo over 8 years ago

These are the results of my tests:
I have entered "My borderiou course 2"
I have tested one test with one image from other course( "Test avec une image d'un autre cours") It worked fine
I have tested one test with only one question with one image from other course( "Test question seule et image dans un autre cours")
I couldn't end the test(See the image)
Drag and Drop of questions works but it shows a SQL string:

"string(135) "UPDATE `stablechamilo`.`c_quiz_rel_question` SET question_order = '1' WHERE question_id = '2' AND c_id = '46' AND exercice_id = '1' " string(135) "UPDATE `stablechamilo`.`c_quiz_rel_question` SET question_order = '2' WHERE question_id = '4' AND c_id = '46' AND exercice_id = '1' " string(135) "UPDATE `stablechamilo`.`c_quiz_rel_question` SET question_order = '3' WHERE question_id = '1' AND c_id = '46' AND exercice_id = '1' " "

See the image

#9

Updated by Julio Montoya over 8 years ago

thanks for the debug I will check this

#10

Updated by Julio Montoya over 8 years ago

  • Status changed from Assigned to Needs testing
  • Assignee changed from Julio Montoya to Yoselyn Castillo
  • % Done changed from 70 to 80

both issues were fixed ...

#11

Updated by Yannick Warnier over 8 years ago

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

Tested and approved. Great.

Also available in: Atom PDF