Surveying Students

A simple survey can be completed in BitterSuite. For example, the file provided to students may begin with:

 ;; Most of the editing you need to do involves "uncommenting", or
 ;;   removing the two semicolons at the start of your answer to a question.
 ;; Follow the instructions below before saving and submitting this file.

   ;; Uncomment one or more of the strings below corresponding to
   ;;   the major(s) you are in or hope to be in. If you're not sure,
   ;;   choose the most likely one.

   ;; "Actuarial Science"
   ;; "Applied Math"
   ;; "C&O"
   ;; "CS"
   ;; "Double Degree"
   ;; "Math/Business"
   ;; "Pure Math"
   ;; "other" ;; replace by your chosen major if you wish

   ;; Uncomment one of "yes" or "no" based on your answer to this question:
   ;; Are you taking one or more of the advanced math courses this term?

   ;; "yes"
   ;; "no"

Then, a test.exe file in a (language external) context could contain the following, with the regular expression expanded as needed.

#!/usr/bin/env bash

if [ -e $submitdir/ ]; then

        # Confirm that the survey is answered correctly
        result=`perl -pe 's/[;#][^\n]*\n//' $submitdir/ | tr -d '\r' | tr -d '\n' | tr -d ' ' | grep -E '"MAJOR"("ActuarialScience"|"AppliedMath"|"C&O"|"CS"|"DoubleDegree"|"Math/Business"|"PureMath"|".*")+"ADVANCEDMATH"("yes"|"no")[...]) | wc -l`
        if [ $result -gt 0 ]; then
                echo "The information in has been filled out correctly." >&4
                echo '100' >&3
                echo "The information in has not been filled out correctly.  Only uncomment your answers. Do not remove anything but comments. Do not add any text to the document." >&4
                echo '0' >&3
        echo "No submitted." >&4
        echo '0' >&3
Topic revision: r1 - 2010-01-05 - TerryVaskor
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback