Esempio n. 1
0
def FillTeacherDictForMonth(ht_or_vt, offset, index, teachers):
    HtmlReuse.CalcDateOffset(offset)
    year = HtmlReuse.year
    month = HtmlReuse.month
    reports = DataModule.GetReports(ht_or_vt, year, month)
    assignments = DataModule.GetAssignments(ht_or_vt, year, month)
    for d in assignments:
        district = assignments[d]
        for c in district.companionships:
            comp = district.companionships[c]
            s = comp.senior_comp.first_name + " " + comp.senior_comp.last_name
            j = comp.junior_comp.first_name + " " + comp.junior_comp.last_name
            if not teachers.has_key(s):
                teachers[s] = {}
            if not teachers.has_key(j):
                teachers[j] = {}
            for teachee in comp.assignments:
                if reports[teachee.first_name + " " +
                           teachee.last_name].visited:
                    teachers[s][index] = "visited"
                    teachers[j][index] = "visited"
                    break
                elif reports[teachee.first_name + " " +
                             teachee.last_name].reported:
                    teachers[s][index] = "not_visited"
                    teachers[j][index] = "not_visited"
            if not teachers[s].has_key(index):
                teachers[s][index] = "not_reported"
                teachers[j][index] = "not_reported"
Esempio n. 2
0
def PrintCsvReports(ht_or_vt):
  import csv
  districts = DataModule.GetAssignments(ht_or_vt,
                                       HtmlReuse.year,
                                       HtmlReuse.month)
  reports = DataModule.GetReports(ht_or_vt, HtmlReuse.year, HtmlReuse.month)
  writer = csv.writer(sys.stdout)
  writer.writerow(["Name",
		   "Visited",
		   "Reported",
		   "Reported By",
		   "Report Notes",
		   "Contact Type",
		   "Senior Companion",
		   "Junior Companion"])

  for d in districts:
    comps = districts[d].companionships
    for c in comps:
      as = comps[c].assignments
      for a in as:
        name = a.first_name + " " + a.last_name
        if reports.has_key(name):
          report = reports[name]
        else:
          report = Sm3Ht.ReportInfo()
        
        writer.writerow([name,
			 report.visited,
			 report.reported,
			 report.reported_by,
			 report.report_notes,
			 report.contact_types,
			 comps[c].senior_comp.first_name + " " +
			 comps[c].senior_comp.last_name,
			 comps[c].junior_comp.first_name + " " +
			 comps[c].junior_comp.last_name])
Esempio n. 3
0
if ht_or_vt == None:
    print "Don't know what type of page this is!"
    sys.exit(0)

month_diff = 0
if form.has_key("chm"):
    month_diff = int(form["chm"].value)
    HtmlReuse.CalcDateOffset(month_diff)

d = -1
c = -1
if form.has_key("d"):
    d = int(form["d"].value)
if form.has_key("c"):
    c = int(form["c"].value)

assignments = DataModule.GetAssignments(ht_or_vt, HtmlReuse.year,
                                        HtmlReuse.month)
reports = DataModule.GetReports(ht_or_vt, HtmlReuse.year, HtmlReuse.month)

#
#
#
HtmlReuse.PrintCal("contact?group=%s&d=%d&c=%d" % (ht_or_vt, d, c), month_diff)
print "<br><br>"
if len(assignments) > 0 and d != -1 and c != -1:
    DisplayContactDynamic.PrintHtml(d, c, ht_or_vt, assignments, reports,
                                    month_diff)
else:
    print "<h2>Assignments for this month have not been uploaded yet.</h2>"