Where to put uploaded files for questions

Where to put uploaded files for questions

by Tim Hunt -
Number of replies: 27
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Adriane, my GSoC mentee, is working on a file-upload question type, and she asked me where the files that the students upload should be stored.

This is a surprisingly difficult question. Since questions can be shared between courses, the course where a question was defined, and the course where a student attempts it may be different. (And after Moodle 1.9, questions will belong to contexts, not courses.) We are talking about files that are uploaded when the student attempts the question.

Remember that questions can be used by any module, not just the quiz.

At the moment, if you want to get from an attempt on a question, to a course, you need to track through these database tables:

question_session -> question_attempt -> quiz_attempt -> quiz -> course.

and that is quiz-specific. So it looks like it is very difficult to use a path like the one used for forum attachments:
[course.id]/moddata/[forum]/[forum.id]/[discussion.id]


So I am thinking that the best solution is to make a new folder at the top level of moodledata, and then use paths like

questionattempt/[question_attempt.id]/[question_session.questionid]

What do people think?
Average of ratings: -
In reply to Tim Hunt

Re: Where to put uploaded files for questions

by John Isner -
I know it would be a big change, but what about refactoring the File system from courses into contexts, so that every context would have its own file system? Files stored in a context file system would be visible to everyone in the context and nested contexts. This would solve numerous other sharing problems.

Would your new file-upload question type be equivalent to allowing attachments to Essay questions? See MDL-8229.
In reply to John Isner

Re: Where to put uploaded files for questions

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
John - I think I'm with you on this one. It seems to follow Moodle's logic. We have sessions, users, courses, groups and now contexts. However a course is a context so it seems that would follow the logic of how Moodle is designed. Peace - Anthony
In reply to John Isner

Re: Where to put uploaded files for questions

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
A good time to attempt refactoring like this would be for the new Repository API in 2.0 (development starting in a few months).


In the meantime, I think Tim's proposal looks OK.
In reply to John Isner

Re: Where to put uploaded files for questions

by Adriane Boyd -
Yes, it is basically equivalent to allowing attachments to essay questions. The grading works the same as for essay questions and I modeled the uploading after the single upload assignment type.
In reply to Adriane Boyd

Re: Where to put uploaded files for questions

by John Isner -
Adriane,
This question type will be a welcome addition for math teachers.
In reply to Adriane Boyd

Re: Where to put uploaded files for questions

by John Isner -
I just looked at your new question's student interface, and I notice that it is not equivalent to essay plus attachment. Specifically, there is no essay! Unfortunately, this will not handle the use case described below, which occurs in math and other disciplines in which students are expected to create graphs and diagrams. The use case has been discussed in the math tools forum and again in MDL-8229.

Math students use GeoGebra to create graphs, do geometric constructions, etc. One of the questions on a test asks students to (a) do a particular geometric constructions using GeoGebra, creating a GeoGebra worksheet and (b) describe the steps of the construction in text.

With your student interface, students can upload the worksheet but cannot describe the steps they used to create it.

In reply to John Isner

Re: Where to put uploaded files for questions

by Adriane Boyd -
Sorry I didn't describe it more clearly. I was thinking that you could use an essay question in combination with a file upload question to handle this case. I didn't think it was necessary to duplicate the essay question function in the new question type, but if there's a clear need to have an additional essay response field, it could be added in without too much work.
In reply to Adriane Boyd

Re: Where to put uploaded files for questions

by John Isner -
you could use an essay question in combination with a file upload question to handle this case

...and push the problems into the gradebook? No, thanks.

if there's a clear need to have an additional essay response field, it could be added in without too much work

There is a clear need! The use case applies whenever the attachment contains anything other than text. For example, it could be a score produced by a music composition program or a drawing produced by AutoCad. Then the student needs a way to provide additional textual commentary to supplement the submission.



In reply to John Isner

Re: Where to put uploaded files for questions

by Adriane Boyd -

If I may play the devil's advocate to some extent, how does this push the problem to the gradebook?

It seems to me like writing up how a file was created and the file itself are two different things. I am mainly hesitant to duplicate the essay question. The assignment activity also separates file uploads from online text submissions.

In reply to Adriane Boyd

Re: Where to put uploaded files for questions

by John Isner -
how does this push the problem to the gradebook?

Because you now have two items to grade when logically there is only one. The essay and the attachment are meaningless individually.

It seems to me like writing up how a file was created and the file itself are two different things.

It's not about "how the file was created." Reread my example of a geometry construction. The worksheet shows the finished construction. The text describes the steps. Here is the example text:

Bisect an angle:
  1. Draw an arbitrary angle with vertex V
  2. Draw an arc centered at V which intersects the sides of the angle at P and Q
  3. Draw an arc of arbitrary radius centered at P
  4. Draw a second arc of equal radius centered at Q
  5. The arcs drawn in steps 3 and 4 intersect at X
  6. Draw a line connecting V and X
  7. The line connecting V to X bisects the angle
(see screenshot for an image of the worksheet).

As I said earlier, every discipline with its own special language and notation (math, music, engineering, chemistry, ... ) can furnish examples in which a student-produced file is meaningless without accompanying text.
In reply to John Isner

Re: Where to put uploaded files for questions

by Adriane Boyd -
Okay, it's in the quiz grading and not the gradebook. I was slightly confused. Although, you could give the essay question a weight of 0 and only need to grade the file upload (or vice versa), but that's still slightly clunky. I will add an optional essay field to the question type.
In reply to Adriane Boyd

Re: Where to put uploaded files for questions

by John Isner -
Thanks!

(or add the optional attachment field to the essay and have one less question type to maintain smile
In reply to John Isner

Re: Where to put uploaded files for questions

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
John > add the optional attachment field to the essay and have one less question type to maintain
Way to go!
Joseph
In reply to Tim Hunt

Re: Where to put uploaded files for questions

by Ralf Hilgenstock -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Translators
Hi Tim,

In addition to your suggestion, how do you show the uploaded files for the teacher? Using assignments taecher ask often how to download all the uploaded files and to show the results to the students. It would be great to add an option to publish results as a folder.



In reply to Ralf Hilgenstock

Re: Where to put uploaded files for questions

by Adriane Boyd -

The uploaded files are shown to the teacher as links in the question context. The initial version looks like this: file response student interface mockup.

I agree that it would be useful to allow the teacher to download all the files at once, but I'm not sure where/how to add something like that since it would be in the activity module rather than in the question type code.

In reply to Adriane Boyd

Re: Where to put uploaded files for questions

by Ralf Hilgenstock -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Translators
Hi Adriane,

a question is used in the context of a course. A teacher ist working in the course context and s/he is grading the files/answers in this course. The workplace should be similar to the grading table in the assignment activity (see attached screen). If I think about usability similar functions should work in the same way at different places.
In reply to Ralf Hilgenstock

Re: Where to put uploaded files for questions

by Adriane Boyd -

In terms of having similar behavior across instances, I think that it is more important for the file upload question type to behave like other question types than for it to be similar to submissions in the assignment activity. I added a screenshot of the grading page to my project page to show what it would look like. This page is just the result of specifying manual grading for the question type, no other changes required. It looks exactly like the essay question grading page in the context of a quiz.

In reply to Tim Hunt

Re: Where to put uploaded files for questions

by Ricardo Rodríguez García -
This will be applied to the images used in questions too?
Because the are several problems when someone shares a question and the question use images that where uploaded to a course
http://moodle.org/mod/forum/discuss.php?d=73075#p326443
http://moodle.org/mod/forum/discuss.php?d=67517#321031
http://moodle.org/mod/forum/discuss.php?d=69740#312844
http://moodle.org/mod/forum/discuss.php?d=65049#306078
http://moodle.org/mod/forum/discuss.php?d=67006#302806
http://moodle.org/mod/forum/discuss.php?d=66283#p298398
http://moodle.org/mod/forum/discuss.php?d=64368#290382
http://moodle.org/mod/forum/discuss.php?d=64277#290274
http://moodle.org/mod/forum/discuss.php?d=62846#283751
http://moodle.org/mod/forum/discuss.php?d=60853#275810
http://moodle.org/mod/forum/discuss.php?d=58774#268146

This would solve numerous other question sharing problems.

And what will happen in case of export, import, backup and restore a question?
i think this is a serious bug that should be fix and maybe now is the time to do it

here is some work on importing images from webct maybe could help http://moodle.org/mod/forum/discuss.php?d=32976#311667

and another suggestion the answer field in the multi choice question type should be show with a htmleditor due to to the need to use images in the answers

I hope this help
In reply to Ricardo Rodríguez García

Re: Where to put uploaded files for questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The question sharing problems are an entirely separate issue, and are being solved by Jamie Pratt as explained here:
In reply to Tim Hunt

Re: Where to put uploaded files for questions

by John Isner -
Tim,
According to the doc you referenced,
  • If a question is shared at the course or module level, "associated files" (e.g., images, files uploaded by students) will be stored in the course files area
  • If a question is shared at the course category or site level, associated files will be stored in site files.

This could be a problem for category-level or site-level questions containing files uploaded by students, since "Files placed [in site files] can be accessed by anyone."
In reply to Tim Hunt

Re: Where to put uploaded files for questions

by John Isner -
Hi Tim,
I just checked my new 1.9 site to see if Essay questions permitted attachments. Alas, they don't. I wondered if Adriane completed the GSoC project, and if so, whether it is in a state that can be added to 2.0.

Lack of attachments in Essay questions is a continuing obstacle for math teachers. I just (mis)informed one user that we had it. His college is evaluating a conversion from NetTutor. They need to convert NetTutor worksheets to Moodle quizzes using Essay questions with attachments for graphs and geometric constructions (e.g., created by GeoGebra). The fact that they do not have a viable conversion option may be a showstopper for them.


In reply to John Isner

Re: Where to put uploaded files for questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Adriane's question types are available from http://moodle.org/mod/data/view.php?d=13&mode=list&advanced=1&f_46=Question+Type&f_98=Third-Party at the moment. They should just plug in, but when I quickly tried to plug them into the OU's customised Moodle some time ago, some of them did not work, and I did not have time to investigate in detail wether it was our customisations of the plugins that were the problem.

After the moodle moot, I am hoping that I, or one of my colleagues will have time to install them. Then I can get our professional QA staff and accessibility experts to give them a thorough going over. I am also hoping that other people here will try them out and report their findings.

But since question types should simply plug-in to Moodle now, I am not in a hurry to add new question types to the official Moodle version. I think any candiate question type needs to meet these criteria before it is added:

1. Has been used in a production environment by half a dozen institutions who report they are happy with it.

2. Pass a code and accessibiltiy review.

3. Are a question type that one would expect the majority of teachers to find useful.
In reply to Tim Hunt

Re: Where to put uploaded files for questions

by John Isner -
Tim,
Thanks. I didn't realize it was available as a plugin.
In reply to Tim Hunt

Re: Where to put uploaded files for questions

by John Isner -
Tim,
I'm playing with the File Response question type on my 1.9 system. I'm also trying to get a sense of your direction on this.

In the documentation wiki, you say that File Response has the lowest priority of any of the question types. The File Response README says that backup/restore won't be added until the question type is officially released. Catch-22: If File Response doesn't make it into core, who is going to write the Backup/Restore? And if no one writes the Backup/Restore, isn't the question type basically useless? Would I be doing people a disservice by recommending this question type?
In reply to John Isner

Re: Where to put uploaded files for questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I said that? I wonder why? Don't read too much into it.

Probably the right long-term plan is to merge the file response question type into the Essay question. At the moment, file resonse has an optional essay question-like text entry block, so the two overlap. We should have one question type where the text box or the upload can be otional.

The difficult bit of what Adriane did over the summer was working out how the essay question could handle uploaded files from a student attempt. Now we have that machanism in place, any question type can process uploaded files if it wants to.

In the mean time, doing backup and restore for the file respons type would not be terribly hard, but it does involve knowing how to get extra files included in the backup, and Adriane did not have time to work that bit out over the summer.
In reply to Tim Hunt

Re: Where to put uploaded files for questions

by John Isner -
Probably the right long-term plan is to merge the file response question type into the Essay question. At the moment, file resonse has an optional essay question-like text entry block, so the two overlap. We should have one question type where the text box or the upload can be otional.

That's absolutely the right way to go! Math teachers will be forever in your debt for this.
In reply to John Isner

Re: Where to put uploaded files for questions

by Michael Penney -
Would I be doing people a disservice by recommending this question type?

I would say yes, until Backup and Restore works this should not be used or recommended--if you rec. it people will expect B+R to work and be very upset when it doesn't--no matter what you tell them before they download/install it.