Results 1 to 2 of 2

Thread: fmcompute and or .ini file question

  1. #1
    Join Date
    Apr 2008
    Posts
    6

    Default fmcompute and or .ini file question

    I am using FormMail to grade and maintain scores
    for quizzes submitted online.

    all is well except I would like to change the score if students turn in
    quizzes after the "latedate"

    see http://www.271828.com/141/quiz13/

    (for testing purposes i made all answers "A")

    currently my .ini file runs a script and computes the "TotalScore"

    I would like it to go one step further .. something like:


    $currenttime = strtotime("now");
    $latedate= xyz date; ///ie. something like $duedate + 2 days...

    if ($currenttime > $latedate){
    TotalScore = max(TotalScore, 75);
    }


    but none of this works on the .ini file.. and I don't know how to properly fix it... I have purchased the fmcompute module...

    any help would be greatly appreciated..

    BTW if any teachers are reading this.. this set up has saved me TONS of time.. I can give a quiz each week, get it graded and returned and scores
    compiled x300 students... all effortlessly...

  2. #2
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: fmcompute and or .ini file question

    Hi,

    The problem consists of these subproblems:
    1. Collecting the submission date.
    2. Collecting the "late" date.
    3. Comparing the two dates.
    The Computation Module currently lacks date processing, but dates can be represented as numbers or as strings and compared that way.

    To collect the submission date, derive a field on your HTML form:
    HTML Code:
    <input type="hidden" name="derive_fields"
     value="date_now=%fullyear%.%moy0%.%dom0%.%hour240%" />
    So, 10am on Jan 14th 2010, will produce a "date_now" field of "2010011410".

    This allows you to compare down to hour level. If you want to compare to minute, you can add the minutes too.

    If you just want to compare to day level, leave out the hour (.%hour240%).

    Next, in your computation, just create a local variable to contain the late date:
    Code:
    string          late_date;
    
    late_date = '2010011412';  /* this format is YYYYMMDDHH */
    And, finally, import the date_now field and do your comparison:
    Code:
    import string date_now;
    
    if (date_now > late_date) {
       /* the logic you want to execute when the submission is late */
    }
    Depending on how worried you are about hacking students, you can do various checks on the "date_now" value to ensure it's real. Or, you can derive in in the INI file in the "special_fields" section.

    When you change your quiz, you just have to change the "late_date" value to the new value.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Newbie question on open_basedir error
    By zenprofit in forum FormMail Subscription Support
    Replies: 14
    Last Post: 14-Feb-2005, 09:35 PM
  2. question about PHP version 4.3.8
    By djgotee in forum FormMail Subscription Support
    Replies: 4
    Last Post: 28-Nov-2004, 11:46 PM
  3. TARGET_EMAIL question
    By middleburyman in forum FormMail Subscription Support
    Replies: 1
    Last Post: 03-Sep-2004, 08:30 PM
  4. Uploading question
    By tray in forum FormMail Subscription Support
    Replies: 2
    Last Post: 11-Aug-2004, 09:31 PM
  5. at mangle / e-mail question
    By Ibis in forum FormMail Subscription Support
    Replies: 3
    Last Post: 25-Feb-2004, 02:59 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •