WeBWorK Problems

use of webwork with moodle

use of webwork with moodle

by Jean-Philippe JP -
Number of replies: 3

Hi,

I am having some trouble copy pasting problems from webwork to moodle. For exemple I set up pop up hints after each try for the webwork problems. It was working fine  on webwork, but once I copy pasted it on moodle the hints werent poping up anymore. The same thing was happening for images. they were appearing fine on webwork and once i copy pasted the code on moodle it wasnt there.

thank you,

jp

In reply to Jean-Philippe JP

Re: use of webwork with moodle

by Michael Gage -
I'm assuming that you are using the question server "bridge2" between moodle and webwork (http://webwork.maa.org/wiki/Moodle_Question_Type). I don't believe that the infra-structure for supporting hints will work (I'm not even sure whether the moodle quiz model has a hints feature).

I also don't believe that the webwork questions which refer to external files (e.g. an external .gif file) will work correctly. That is a feature that hasn't yet been implemented. I'm pretty sure that webwork questions which generate graphics on-the-fly will work correctly.

If you give me specific path to problems that aren't working (tell me where they are in the question library) I may be able to tell you more definitely whether there is a work around for that particular question.


In reply to Michael Gage

Re: use of webwork with moodle

by Jean-Philippe JP -

Hi,

This is what i was doing for my hints. They appear as notes at the bottom of the page. For exemple, i cant see the first hint on the moodle version of the problem but i cant see the other hints for some reason.

DOCUMENT();
# Load whatever macros you need for the problem
loadMacros("PG.pl",
           "PGbasicmacros.pl",
           "PGchoicemacros.pl",
           "PGanswermacros.pl",
           "PGauxiliaryFunctions.pl",
           "PGgraphmacros.pl",
           "problemRandomize.pl",
           "PGstandard.pl",
           "MathObjects.pl",
           "PGcourse.pl",
             );
ProblemRandomize(when=>"always",onlyAfterDue=>0); 
## Do NOT show partial correct answers
#install_problem_grader(~~&std_problem_grader);    ##uncomment to use std grader
#install_problem_grader(~~&custom_problem_grader);  ##uncomment to use custom grader

$showPartialCorrectAnswers = 1;
TEXT(beginproblem());
$k1 = list_random(0.001,0.012,0.032,0.017,0.0054,0.029);
$d1 = list_random(5,3,12,21,3,11);
$x1 = list_random(0.99,0.89,0.45,0.76,0.21,0.76);
$q1 = list_random(19,10,12,11,14,15);
$vcstr = ($x1*$q1)/ (3600*$k1*(1-$x1));
$vpfr = ($q1/(3600*$k1))*ln(1/(1-$x1));
BEGIN_TEXT
Soit la réaction suivante:$PAR
A -> B$PAR 
s’effectuant dans un réacteur isotherme à une température donnée T. Calculer les volumes nécessaires afin d'atteindre une conversion X de l'espèce A de \($x1\)*100% dans un réacteur piston et parfaitement agité. Le débit molaire est de \($d1\) mol/h et le taux de réaction est:$PAR
- rA = kCa $PAR 
 \($k1\) s-1$PAR
Le débit volumique entrant est de \($q1\) dm3/h.$PAR
CSRT=\{ans_rule(40)\}litres$PAR
PFR=\{ans_rule(40)\}litres$PAR

END_TEXT
$ans = $vcstr;
&ANS(num_cmp($ans, reltol => 15));
$ans = $vpfr;
&ANS(num_cmp($ans, reltol => 15));
@hints = (
"Faites attention aux unités",
      "Vous devez seulement utiliser une formule pour arriver à la réponse pour le volume du PFR et une autre pour le volume du CSTR.",
      "Avez-vous pensé aux formules de design du PFR et CSTR",
      "Il n'y a plus d'autre indice!!!",
    );
    install_problem_grader(sub {
      my ($result,$state) = avg_problem_grader(@_);
      if ($state->{num_of_correct_ans} == 0) {
        my $n = $state->{num_of_incorrect_ans} - 1;
        $n = $#hints if $n > $#hints;
        if ($n >= 0) {
          $result->{msg} .= '</i><p><b>Note:</b> <i>' if $result->{msg};
          $result->{msg} .= $hints[$n];
        }
     }
      ($result,$state);
    });
     install_problem_grader(sub {
      my ($result,$state) = avg_problem_grader(@_);
      if ($inputs_ref->{AnSwEr1} eq 'reset') {
        $state->{num_of_correct_ans} = 0;
        $state->{num_of_incorrect_ans} = 0;
        $state->{recorded_score} = 0;
        $result->{score} = 0;
      } elsif ($state->{num_of_correct_ans} == 0) {
        my $n = $state->{num_of_incorrect_ans} - 1;
        $n = $#hints if $n > $#hints;
        if ($n >= 0) {
          $result->{msg} .= '</i><p><b>Note:</b> <i>' if $result->{msg};
          $result->{msg} .= $hints[$n];
        }
      }
      ($result,$state);
    });
ENDDOCUMENT();
Thanks,
jp
In reply to Michael Gage

Re: use of webwork with moodle

by Jean-Philippe JP -

Sorry,

I wrote can't but i meant can***. I can see the first hint on the moodle version of the problem but not the other hint after each submitted anwser.

thanks,

jp