From d84e5f43d16957f6223430f63bdfbc3fdf4aea2a Mon Sep 17 00:00:00 2001 From: Kanika Goyal Date: Fri, 23 Mar 2012 08:56:13 +0530 Subject: [PATCH] MDL-31856 Choice: if choice not open, responses inconsistently displayed --- mod/choice/view.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mod/choice/view.php b/mod/choice/view.php index e4a49b0b928..d09728647de 100644 --- a/mod/choice/view.php +++ b/mod/choice/view.php @@ -100,16 +100,16 @@ echo $OUTPUT->box(format_module_intro('choice', $choice, $cm->id), 'generalbox', 'intro'); } + $timenow = time(); $current = false; // Initialise for later - //if user has already made a selection, and they are not allowed to update it, show their selected answer. + //if user has already made a selection, and they are not allowed to update it or if choice is not open, show their selected answer. if (isloggedin() && ($current = $DB->get_record('choice_answers', array('choiceid' => $choice->id, 'userid' => $USER->id))) && - empty($choice->allowupdate) ) { + (empty($choice->allowupdate) || ($timenow > $choice->timeclose)) ) { echo $OUTPUT->box(get_string("yourselection", "choice", userdate($choice->timeopen)).": ".format_string(choice_get_option_text($choice, $current->optionid)), 'generalbox', 'yourselection'); } /// Print the form $choiceopen = true; - $timenow = time(); if ($choice->timeclose !=0) { if ($choice->timeopen > $timenow ) { echo $OUTPUT->box(get_string("notopenyet", "choice", userdate($choice->timeopen)), "generalbox notopenyet");