Exemplo n.º 1
0
    def export_sections_enrollment(self, wb):
        self.task_progress.force('export_sections_enrollment', active=True)
        ws = wb.add_sheet("SectionEnrollment")

        row = 0
        years = ISchoolYearContainer(self.context)
        total_years = len(years)
        for ny, year in enumerate(
                sorted(years.values(), key=lambda year: year.first)):
            total_terms = len(year)
            for nt, term in enumerate(
                    sorted(year.values(), key=lambda term: term.first)):
                sections = ISectionContainer(term)
                total_sections = len(sections)
                for ns, section in enumerate(
                        sorted(sections.values(),
                               key=lambda section: section.__name__)):
                    row = self.export_section_enrollment(ws,
                                                         year,
                                                         term,
                                                         section,
                                                         row=row)
                    self.progress(
                        'export_sections_enrollment',
                        normalized_progress(
                            ny,
                            total_years,
                            nt,
                            total_terms,
                            ns,
                            total_sections,
                        ))

        self.finish('export_sections_enrollment')
Exemplo n.º 2
0
    def export_sections_enrollment(self, wb):
        self.task_progress.force('export_sections_enrollment', active=True)
        ws = wb.add_sheet("SectionEnrollment")

        row = 0
        years = ISchoolYearContainer(self.context)
        total_years = len(years)
        for ny, year in enumerate(sorted(years.values(), key=lambda year: year.first)):
            total_terms = len(year)
            for nt, term in enumerate(sorted(year.values(), key=lambda term: term.first)):
                sections = ISectionContainer(term)
                total_sections = len(sections)
                for ns, section in enumerate(sorted(sections.values(),
                                                    key=lambda section: section.__name__)):
                    row = self.export_section_enrollment(
                        ws, year, term, section, row=row)
                    self.progress(
                        'export_sections_enrollment',
                        normalized_progress(
                            ny, total_years,
                            nt, total_terms,
                            ns, total_sections,
                            ))

        self.finish('export_sections_enrollment')
Exemplo n.º 3
0
 def schoolyears(self):
     app = ISchoolToolApplication(None)
     schoolyears = ISchoolYearContainer(app)
     active_schoolyear = schoolyears.getActiveSchoolYear()
     return [
         schoolyear for schoolyear in schoolyears.values()
         if schoolyear.first >= active_schoolyear.first
     ]
Exemplo n.º 4
0
def evolve(context):
    linkcatalogs.ensureEvolved(context)
    root = getRootFolder(context)
    old_site = getSite()

    app = root
    setSite(app)
    syc = ISchoolYearContainer(app)
    if not syc.values():
        setSite(old_site)
        return

    sy = syc.getActiveSchoolYear()
    if sy is None:
        sy = syc.values()[-1]
    for person in app['persons'].values():
        evolvePerson(app, sy, person)

    setSite(old_site)
Exemplo n.º 5
0
def evolve(context):
    linkcatalogs.ensureEvolved(context)
    root = getRootFolder(context)

    old_site = getSite()
    app = root
    setSite(app)
    persons = ISchoolToolApplication(None)['persons']
    manager = persons.super_user
    if manager is not None:
        syc = ISchoolYearContainer(app)
        for sy in syc.values():
            makeManager(app, sy, manager)

    setSite(old_site)
Exemplo n.º 6
0
 def schoolyears(self):
     app = ISchoolToolApplication(None)
     schoolyears = ISchoolYearContainer(app)
     active_schoolyear = schoolyears.getActiveSchoolYear()
     return [schoolyear for schoolyear in schoolyears.values()
             if schoolyear.first >= active_schoolyear.first]