Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-13158

choice/index.php only return values for choices in the current course.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9
    • Component/s: Choice
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      TODO: limit to choices from this course only from Skodak:

      if ( !empty($USER->id) and $allanswers = get_records("choice_answers", "userid=".$USER->id." AND coursid)) { // TODO: limit to choices from this course only

      could replace the $allanswers call with this:
      $allanswers = get_records_sql("SELECT choice_answers.id, choice_answers_choiceid, choice_answers.optionid FROM choice, choice_answers WHERE choice_answers.choiceid = choice.id AND choice.course=". $course->id." AND choice_answers.userid=".$USER->id);

      although I'm not too sure about the performance of using get_records_sql against 2 tables instead of just using get_records against one.

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            danmarsden Dan Marsden
            Participants:
            Component watchers:
            Dan Marsden, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              3/Mar/08