[LON-CAPA-users] Conditional Block Issue

Harding, Gene L glhardin at purdue.edu
Fri May 11 22:08:47 EDT 2018


Oh, wow, that's all it was. Thank you Stuart and Yuk for spotting it. Sorry to email the listserv with such a dumb mistake!

Best regards,

Gene L. Harding, PE
Associate Professor of ECET
574-520-4190

-----Original Message-----
From: LON-CAPA-users <lon-capa-users-bounces at mail.lon-capa.org> On Behalf Of Stuart Raeburn
Sent: Friday, May 11, 2018 8:11 PM
To: lon-capa-users at mail.lon-capa.org
Subject: Re: [LON-CAPA-users] Conditional Block Issue

Hello Gene,

Without looking in detail at your code, one thing jumped out at me when glancing at your code.

In the text included in your e-mail to the users list you have:

<block condition="status_a">

I don't know whether that's just a typo in your e-mail, but in your LON-CAPA code you'd want:

<block condition="$status_a">


Stuart Raeburn
LON-CAPA Academic Consortium

Quoting "Harding, Gene L" <glhardin at purdue.edu>:

> Hi,
>
> I am trying to display something (a gnuplot) only if the student has

> exceeded the maxtries for a problem and not gotten it correct. I
used
> the following code in the perl script to check the problem status
and
> set a flag ($status_a) to zero only if maxtries is exceeded:
> # Check status: 'undef'=not attempted; 0=wrong but tries left; 
> 1=correct; 2=maxtries exceeded; 3=after answer date $status_a = 
> &check_status('a'); if ($status_a ne 2) {$status_a=0;}  # If maxtries 
> not reached, set
to
> 0 so conditional block does not execute
>
> Then I put the gnuplot code inside a conditional block:
> <block condition="status_a">
> <gnuplot width="700" minor_ticscale="0.75" grid="off" align="right"  
> font="9" height="500" border="on" samples="100"
>           bgcolor="xffffff" fgcolor="x000000" alttag="Spectrum Plot"  
> transparent="off" major_ticscale="2" plottype="Cartesian">
>      <xtics minorfreq="1" location="border" mirror="on"  
> end="$xtic_stop" increment="$xtic_incr" start="0" />
>      <ytics minorfreq="1" location="border" mirror="on" end="20"  
> increment="2" start="0" />
>      <axis xmin="$x_min" ymax="$y_max" color="x000000" ymin="$y_min"  
> xmax="$x_max" />
>      <xlabel>Frequency (MHz)</xlabel>
>      <ylabel>Amplitude (V)</ylabel>
>      <curve linestyle="vector" linetype="solid" arrowangle="30"  
> arrowstyle="filled" color="x000000" pointtype="4"
>             linewidth="1" arrowhead="head" arrowlength="$arwhd"
pointsize="1">
> <!-- vector plot requires 4 datasets: X, Y, deltaX, deltaY -->
>          <data>@f</data>
>          <data>@tails</data>
>          <data>@zeros</data>
>          <data>@mag</data>
>      </curve>
> </gnuplot>
> </block>
>
> I thought conditional blocks were skipped if the condition was zero,

> and executed for nonzero values, but the block is executing even
when
> $status_a is zero. Can anyone see what I am doing wrong? Is there a 
> better/easier way to do this?
>
> Thanks for any help/advice you can provide.
>
> Best regards,
>
> Gene L. Harding, PE
> Associate Professor of ECET
> 574-520-4190
>
>

_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users


More information about the LON-CAPA-users mailing list