def test_01 (): _term = '1' _date = '2016-01-29' for _klass, _pid in ('13', '200301'), ('12.RS', '200403'): klass = Klass(_klass) REPORT.Test("Reading basic grade data for class %s" % klass) #TODO: This might not be the optimal location for this file. filepath = Paths.getYearPath(_testyear, 'FILE_GRADE_TABLE', term=_term).replace('*', str(klass).replace('.', '-')) pgrades = readGradeTable(filepath) REPORT.Test(" ++ INFO: %s" % repr(pgrades.info)) for pid, grades in pgrades.items(): REPORT.Test("\n -- %s: %s\n" % (pid, repr(grades))) REPORT.Test("\nReading template data for class %s" % klass) # Get the report type from the term and klass/stream _rtype = klass.match_map(CONF.GRADES.REPORT_TEMPLATES['_' + _term]) gradedata = GradeReportData(_testyear, _rtype, klass) REPORT.Test(" Indexes:\n %s" % repr(gradedata.sgroup2indexes)) REPORT.Test(" Grade tags:\n %s" % repr(gradedata.sgroup2sids)) grademap = klass.match_map(CONF.MISC.GRADE_SCALE) REPORT.Test("\nTemplate grade map for pupil %s (using %s)" % (_pid, grademap)) tagmap = gradedata.getTagmap(pgrades[_pid], "Pupil_%s" % _pid, grademap) REPORT.Test(" Grade tags:\n %s" % repr(tagmap))
def index(): schoolyear = session['year'] form = DateForm() if form.validate_on_submit(): # POST # Store date of issue _date = form.getDate() db = DB(schoolyear) db.setInfo('TEXT_DATE_OF_ISSUE', _date) # GET form.defaultIssueDate(schoolyear) p = Pupils(schoolyear) _kmap = CONF.TEXT.REPORT_TEMPLATES['Mantelbogen'] klasses = [] for k in p.classes(): klass = Klass(k) if klass.match_map(_kmap): klasses.append(str(klass)) return render_template(os.path.join(_BPNAME, 'index.html'), form=form, heading=_HEADING, klasses=klasses)