New field in question table : not able to insert field value.

New field in question table : not able to insert field value.

by Bhargava S -
Number of replies: 3

Hi,

It could be wrong, but i need to add a custom field in mdl_question table.

I want to use this for displaying custom question number.

I added a text element  in file /question/type/edit_question form and the new field reflected while adding a new question.

I added a corresponding column, with the same name as in form, in mdl_question table.

I did purge all cache. I am expecting the new field value to get inserted automatically.

The new question is saved to database but not the custom field value.

I have not been able to trace where a new question is inserted into database.

Please help and guide me.


Average of ratings: -
In reply to Bhargava S

Re: New field in question table : not able to insert field value.

by Bhargava S -

Edit : The approach has changed.  I have been asked to ensure that a display number can be provided for a question when it is added to quiz. This display number is to be used while presenting attempts. So different display numbers for a question for diffferent quizzes.


I am now looking at quiz_slots table.

Regards.

In reply to Bhargava S

Re: New field in question table : not able to insert field value.

by Priya Shanu -
If company quiz and internal quizzes are in different courses then enrol internal trainers in course which

include internal quizzes only,as if they are not enrolled in course of 'company quiz',they won't be able to

view grades/mark of this quiz.
In reply to Bhargava S

Re: New field in question table : not able to insert field value.

by Priya Shanu -

Sry for the above reply,

As you can see in quiz_slots table each question has question id stored as 'questionid' in this 

table and each questionid is stored with different id...you can use that 'id' field of quiz_slot to 

display different numbers for a question for diffferent quizzes using below query:

$displayno = $DB->get_record_sql('SELECT mdl_ quiz_slots.id FROM mdl_course

  

   join mdl_quiz on mdl_course.id = mdl_quiz.course

  

   join mdl_quiz_slots on mdl_quiz_slots.quizid = mdl_quiz.id

   

   join mdl_question on mdl_question.id = mdl_quiz_slots.questionid

  

  WHERE mdl_course.id = '.$courseId.' AND mdl_quiz.id= '.$quizId.' AND      


  mdl_quiz_slots.questionid= '.$questionId->questionid);