Esempio n. 1
0
questions.extend(["power.q00000"+str(i) for i in range(1,7)])
questions.append("nyan.q000005")
questions.extend(["potLoading.q00000"+str(i) for i in range(5)])

kerberoses = ['diomidov','jtwright','lroberto', 'jrgraves', 'evab','ezhou','habadio','bsnowden','rbuhai','liangx','trattner', 'kelvinlu', 'tschoen', 'ericluu', 'romero', 'lorenzov', 'jdkaplan', 'aboggust', 'wiliamm','keam','hyshwang','txz','akkas','mshum97','dvuong','zhuw','kevzhao','jbergero','shahp','kwlee','efriis','rruiz','simpsonr','pointing','carbaugh']

user = '******'

for q in questions:
   print(q)
   critDicts = dataFuncs.getCriteria(q)
   critObjs = []
   # create list of criteria
   for c in critDicts:
      clazz = getattr(criteria, c['type'] + "Criteria")
      inst = clazz(c['args'])
      critObjs.append(inst)
   for k in kerberoses:
      graphJSON = dataFuncs.getStudentData(k, q)
      if graphJSON == None: continue
      print('\t' + k)
      graphData = graphUtil.GraphData(graphJSON)
      answers = []
      for c in critObjs:
         grade = c.grade(graphData)[0]
         answers.append('true' if grade >= 1 else 'false')
      dataFuncs.saveTeacherGrade(user, q, k, answers)


print("done")
Esempio n. 2
0
cgitb.enable()

form = cgi.FieldStorage()
error = '''
{"error":'error. Missing data. Only received %(formKeys)s'}''' % {
    'formKeys': form.keys()
}

if 'request' in form and str(form['request'].value) == 'getOptions' and\
        all([k in form for k in ['problemID']]):
    pid = str(form['problemID'].value)
    data = dataFuncs.getOptionsData(pid)
    print '''
%(data)s''' % {'data': data}
elif 'request' in form and str(form['request'].value) == 'getStudentData' and\
        all([k in form for k in ['problemID', 'kerberosHash']]):
    pid = str(form['problemID'].value)
    kh = str(form['kerberosHash'].value)
    data = dataFuncs.getStudentData(kh, pid)
    print '''
%(data)s''' % {'data': data}
elif 'request' in form and str(form['request'].value) == 'getStudentRecording' and\
        all([k in form for k in ['problemID', 'kerberosHash']]):
    pid = str(form['problemID'].value)
    kh = str(form['kerberosHash'].value)
    data = dataFuncs.getStudentRecording(kh, pid)
    print '''
%(data)s''' % {'data': data}
else:
    print error
Esempio n. 3
0
    'bsnowden', 'rbuhai', 'liangx', 'trattner', 'kelvinlu', 'tschoen',
    'ericluu', 'romero', 'lorenzov', 'jdkaplan', 'aboggust', 'wiliamm', 'keam',
    'hyshwang', 'txz', 'akkas', 'mshum97', 'dvuong', 'zhuw', 'kevzhao',
    'jbergero', 'shahp', 'kwlee', 'efriis', 'rruiz', 'simpsonr', 'pointing',
    'carbaugh'
]

user = '******'

for q in questions:
    print(q)
    critDicts = dataFuncs.getCriteria(q)
    critObjs = []
    # create list of criteria
    for c in critDicts:
        clazz = getattr(criteria, c['type'] + "Criteria")
        inst = clazz(c['args'])
        critObjs.append(inst)
    for k in kerberoses:
        graphJSON = dataFuncs.getStudentData(k, q)
        if graphJSON == None: continue
        print('\t' + k)
        graphData = graphUtil.GraphData(graphJSON)
        answers = []
        for c in critObjs:
            grade = c.grade(graphData)[0]
            answers.append('true' if grade >= 1 else 'false')
        dataFuncs.saveTeacherGrade(user, q, k, answers)

print("done")
Esempio n. 4
0
    dataFuncs.saveTeacherGrade(user, saveQuestion, saveKerberos, answers)
    print 'Location: ?student=%(next_pres)s&questionID=%(index)s&user=%(user)s'\
         % {'next_pres': next_p, 'index': form['questionID'].value, 'user':user}

elif form.has_key('selectUsername'):
    print 'Location: ?student=%(president)s&questionID=%(index)d&user=%(username)s' \
         % {'president': president, 'index': questionID, 'username':form['username'].value}

question = questions[questionID]
next_questionID = (questionID + 1) % len(questions)

imageSrc = "images/" + question.replace('.','') + ".png"

for i in range(len(kerberoses)):
    try:
        studentData = dataFuncs.getStudentData(kerberos, question)
        break
    except:
        kerberos = kerberoses[i]
        president = mapping[i]
    
displayData = dataFuncs.getDisplayData(question)
criteriaList = dataFuncs.getCriteriaCheckboxList(question)
next_kerberos = dataFuncs.getNextThing(kerberos, question)
next_pres = mapping[kerberoses.index(next_kerberos)]
lastGrade = dataFuncs.getTeacherGrade(user, question, kerberos)

numberGraded = 0 #len(dataFuncs.getResponseData(user)) - 1
thanksText = ""
if numberGraded == 0:
    thanksText = "Don't be scared to enter a grade."
Esempio n. 5
0
import cgitb
import dataFuncs
cgitb.enable()

form = cgi.FieldStorage()
error = '''
{"error":'error. Missing data. Only received %(formKeys)s'}''' % {'formKeys':form.keys()}

if 'request' in form and str(form['request'].value) == 'getOptions' and\
        all([k in form for k in ['problemID']]):
    pid = str(form['problemID'].value)
    data = dataFuncs.getOptionsData(pid)
    print '''
%(data)s''' % {'data':data}
elif 'request' in form and str(form['request'].value) == 'getStudentData' and\
        all([k in form for k in ['problemID', 'kerberosHash']]):
    pid = str(form['problemID'].value)
    kh = str(form['kerberosHash'].value)
    data = dataFuncs.getStudentData(kh, pid)
    print '''
%(data)s''' % {'data':data}
elif 'request' in form and str(form['request'].value) == 'getStudentRecording' and\
        all([k in form for k in ['problemID', 'kerberosHash']]):
    pid = str(form['problemID'].value)
    kh = str(form['kerberosHash'].value)
    data = dataFuncs.getStudentRecording(kh, pid)
    print '''
%(data)s''' % {'data':data}
else:
    print error