[LON-CAPA-users] block conditions based on elapsed time

Stuart Raeburn raeburn at msu.edu
Tue Nov 10 18:22:32 EST 2015


Bob,

> I don't see a way to get the current date/time in lon-capa so I'm not sure
> how we could accomplish this.  Any suggestions?

Within a script block you can use the LON-CAPA function:
&EXT('system.time')

to retrieve the current time as an epoch/Unix time, and

&EXT('resource.'.$partid.'.duedate')

to retrieve the due date for part: $partid as an epoch/Unix time for  
the current user. For a problem without parts use a $partid of 0.

The LON-CAPA function: &due_date($partid)

will retrieve the due date for the current user for part: $partid  
displayed in the format: day month date HH:MM:SS am/pm YYYY (Time  
Zone).  For a problem without parts omit $partid.


Stuart Raeburn
LON-CAPA Academic Consortium


Quoting Bob Gonzales <rgonzal at binghamton.edu>:

> Hi,
>
> We have some problems that we use in our lab courses where the students
> enter experimental data in one part of the problem which is then used in
> calculations in another part of the problem.  The displaying of the parts
> are controlled by block conditions.
>
> We would like allow them access to the part with the calculations if their
> experimental data is correct OR if they at least tried to enter some
> experimental data AND the lab period is over.  If their experimental data
> is not correct and the lab period is over then we would give them alternate
> data to use for the calculations.
>
> I don't see a way to get the current date/time in lon-capa so I'm not sure
> how we could accomplish this.  Any suggestions?
>
> Thanks,
> Bob Gonzales
> Binghamton University
> Chemistry Dept



More information about the LON-CAPA-users mailing list