Ignore:
Timestamp:
15 Aug 2016, 16:55:04 (8 years ago)
Author:
Henrik Bettermann
Message:

Schow carry-over results.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/students/reports
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/reports/raw_score_report.py

    r14049 r14076  
    5454
    5555def get_courses_2(faccode, depcode, session, level):
    56     """Method 2: Get all courses students of a certain
     56    """Method 2 (not used): Get all courses students of a certain
    5757    department have registered at a certain level.
    5858    """
     
    9696                    scores[ticket.code] = (ticket.score, ticket.grade)
    9797                else:
    98                     scores[ticket.code] = ('N/A', '')
     98                    scores[ticket.code] = ('0', '')
    9999        line = (
    100100                stud.matric_number,
     
    125125    def draw(self):
    126126        canvas = self.canv
    127         canvas.rotate(60)
     127        canvas.rotate(25)
    128128        canvas.drawString( 0, -1, self.text)
    129129
     
    142142    for code in course_codes:
    143143        course = list(catalog.searchResults(code=(code, code)))[0]
    144         col_names += (TTR('%s - %s' % (code, course.title)),)
     144        col_names += (TTR('%s (%s)' % (code, course.credits)),)
    145145    table = [col_names]
    146146    sn = 1
     
    199199        self.creation_dt_string = self.creation_dt.astimezone(
    200200            getUtility(IKofaUtils).tzinfo).strftime("%Y-%m-%d %H:%M:%S %Z")
    201         self.course_codes = get_courses_2(faccode, depcode, session, level)
    202         self.data = get_students(
    203             faccode, depcode, session, level, self.course_codes)
     201        self.past_levels = range(level, 0, -100)[:3]
     202        self.course_codes = dict()
     203        self.data = dict()
     204        for level in self.past_levels:
     205            course_codes = get_courses_1(faccode, depcode, session, level)
     206            self.course_codes[level] = course_codes
     207            self.data[level] = get_students(
     208                faccode, depcode, session, self.levelcode, course_codes)
    204209
    205210    def create_pdf(self):
    206211        creator = getUtility(IPDFCreator, name='landscape')
    207         table_data = tbl_data_to_table(self.data, self.course_codes)
     212        table_data = dict()
     213        for level in self.past_levels:
     214            table_data[level] = tbl_data_to_table(
     215                self.data[level], self.course_codes[level])
    208216        col_widths = [1*cm, 4*cm, 5*cm] + [1*cm] * len(self.course_codes)
    209217        pdf_data = [Paragraph('<b>%s</b>' % self.creation_dt_string,
     
    219227                    STYLE["Normal"]),
    220228                    Spacer(1, 12),]
    221         pdf_data += [
    222             Table(table_data, style=TABLE_STYLE, colWidths=col_widths)]
     229
     230        for level in self.past_levels:
     231            pdf_data.append(Spacer(1, 40))
     232            pdf_data += [Paragraph('<b>Level %s Courses</b>' % level,
     233                        STYLE["Normal"]), Spacer(1, 20),]
     234            pdf_data += [
     235                Table(table_data[level],
     236                      style=TABLE_STYLE,
     237                      colWidths=col_widths)]
    223238        doc_title = translate(_('Raw Score Report'))
    224 
    225239        pdf_data.append(Spacer(1, 40))
    226240        signatures = [
  • main/waeup.aaue/trunk/src/waeup/aaue/students/reports/tests/test_raw_score_report.py

    r14048 r14076  
    1111from waeup.aaue.students.reports.raw_score_report import (
    1212    get_students, RawScoreReport, IRawScoreReport,
    13     get_courses_2 as get_courses)
     13    get_courses_1 as get_courses)
    1414from waeup.aaue.testing import FunctionalLayer
    1515
     
    4949
    5050    def test_create_pdf(self):
    51         report = RawScoreReport('fac1', 'dep1', 2010, 100)
     51        report = RawScoreReport('fac1', 'dep1', 2010, 200)
    5252        result = report.create_pdf()
    5353        self.assertTrue(result.startswith('%PDF-'))
Note: See TracChangeset for help on using the changeset viewer.