Changeset 14605


Ignore:
Timestamp:
7 Mar 2017, 06:51:42 (8 years ago)
Author:
Henrik Bettermann
Message:

Transform helper functions into class methods to ease customization.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students/reports
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/level_report.py

    r14601 r14605  
    3232    StudentStatisticsReportPDFView)
    3333
    34 class ILevelReport(IReport):
    35 
    36     session = Attribute('Session to report')
    37     level = Attribute('Level to report')
    38     faccode = Attribute('Faculty to report')
    39     depcode = Attribute('Department to report')
    40     certcode = Attribute('Certificate to report')
    41     creation_dt_string = Attribute('Human readable report creation datetime')
    42 
    43 def excluded(level_obj):
    44     """Some universities may add further conditions to exclude
    45     students from reports. These conditions can be customized in
    46     this function.
    47     """
    48     return False
    49 
    50 def get_students(faccode, depcode, certcode, session, level):
    51     """Get students in a certain department, studying a certain programmen
    52     who registered courses in a certain session at a certain level.
    53 
    54     Returns a list of student data tuples.
    55     """
    56     site = grok.getSite()
    57     cat = queryUtility(ICatalog, name="students_catalog")
    58     if certcode == 'all':
    59         certcode = None
    60     result = cat.searchResults(
    61         depcode = (depcode, depcode), faccode = (faccode, faccode),
    62         certcode = (certcode, certcode)
    63         )
    64     table = []
    65     format_float = getUtility(IKofaUtils).format_float
    66     for stud in result:
    67         if not stud['studycourse'].has_key(str(level)):
    68             continue
    69         if stud.state == GRADUATED:
    70             continue
    71         level_obj = stud['studycourse'][str(level)]
    72         if level_obj.level_session != session:
    73             continue
    74         if excluded(level_obj):
    75             continue
    76         passed_params = level_obj.passed_params
    77         failed_courses = textwrap.fill(passed_params[4], 35)
    78         not_taken_courses = textwrap.fill(passed_params[5], 17)
    79         fullname = textwrap.fill(stud.display_fullname, 29)
    80         # This is a very special column requested by AAUE, Nigeria.
    81         # The 'remark' column remains empty in base package.
    82         remark = getattr(level_obj, 'remark', '')
    83         end_level = getattr(stud['studycourse'].certificate, 'end_level', None)
    84         credits_counted = level_obj.gpa_params[1]
    85         credits_passed = passed_params[2]
    86         level_gpa = format_float(level_obj.gpa_params[0], 3)
    87         cum_credits_taken = level_obj.cumulative_params[1]
    88         cum_credits_passed = level_obj.cumulative_params[4]
    89         if end_level and level >= end_level:
    90             cgpa = format_float(level_obj.cumulative_params[0], 2)
    91         else:
    92             cgpa = format_float(level_obj.cumulative_params[0], 3)
    93         if remark in ('FRNS', 'NER', 'NYV'):
    94             cgpa = ''
    95             if remark in ('NER', 'NYV'):
    96                 # hide all data (requestd by AAUE, Nigeria)
    97                 credits_counted = ''
    98                 credits_passed = ''
    99                 level_gpa = ''
    100                 failed_courses = ''
    101                 not_taken_courses = ''
    102                 cum_credits_taken = ''
    103                 cum_credits_passed = ''
    104         line = (
    105                 stud.matric_number,
    106                 fullname,
    107                 credits_counted,
    108                 credits_passed,
    109                 level_gpa,
    110                 failed_courses,
    111                 not_taken_courses,
    112                 cum_credits_taken,
    113                 cum_credits_passed,
    114                 cgpa,
    115                 remark,
    116                 )
    117         table.append(line)
    118     return sorted(table, key=lambda value:value[0])
    119 
    12034from reportlab.lib import colors
    12135from reportlab.lib.styles import getSampleStyleSheet
     
    194108    ]
    195109
     110class ILevelReport(IReport):
     111
     112    session = Attribute('Session to report')
     113    level = Attribute('Level to report')
     114    faccode = Attribute('Faculty to report')
     115    depcode = Attribute('Department to report')
     116    certcode = Attribute('Certificate to report')
     117    creation_dt_string = Attribute('Human readable report creation datetime')
     118
    196119@implementer(ILevelReport)
    197120class LevelReport(Report):
     
    207130    note = None
    208131    signatures = None
     132
     133    def _excluded(self, level_obj):
     134        """Some universities may add further conditions to exclude
     135        students from reports. These conditions can be customized in
     136        this function.
     137        """
     138        return False
     139
     140    def _get_students(self, faccode, depcode, certcode, session, level):
     141        """Get students in a certain department, studying a certain programmen
     142        who registered courses in a certain session at a certain level.
     143
     144        Returns a list of student data tuples.
     145        """
     146        site = grok.getSite()
     147        cat = queryUtility(ICatalog, name="students_catalog")
     148        if certcode == 'all':
     149            certcode = None
     150        result = cat.searchResults(
     151            depcode = (depcode, depcode), faccode = (faccode, faccode),
     152            certcode = (certcode, certcode)
     153            )
     154        table = []
     155        format_float = getUtility(IKofaUtils).format_float
     156        for stud in result:
     157            if not stud['studycourse'].has_key(str(level)):
     158                continue
     159            if stud.state == GRADUATED:
     160                continue
     161            level_obj = stud['studycourse'][str(level)]
     162            if level_obj.level_session != session:
     163                continue
     164            if self._excluded(level_obj):
     165                continue
     166            passed_params = level_obj.passed_params
     167            failed_courses = textwrap.fill(passed_params[4], 35)
     168            not_taken_courses = textwrap.fill(passed_params[5], 17)
     169            fullname = textwrap.fill(stud.display_fullname, 29)
     170            # This is a very special column requested by AAUE, Nigeria.
     171            # The 'remark' column remains empty in base package.
     172            remark = getattr(level_obj, 'remark', '')
     173            end_level = getattr(stud['studycourse'].certificate, 'end_level', None)
     174            credits_counted = level_obj.gpa_params[1]
     175            credits_passed = passed_params[2]
     176            level_gpa = format_float(level_obj.gpa_params[0], 3)
     177            cum_credits_taken = level_obj.cumulative_params[1]
     178            cum_credits_passed = level_obj.cumulative_params[4]
     179            if end_level and level >= end_level:
     180                cgpa = format_float(level_obj.cumulative_params[0], 2)
     181            else:
     182                cgpa = format_float(level_obj.cumulative_params[0], 3)
     183            if remark in ('FRNS', 'NER', 'NYV'):
     184                cgpa = ''
     185                if remark in ('NER', 'NYV'):
     186                    # hide all data (requestd by AAUE, Nigeria)
     187                    credits_counted = ''
     188                    credits_passed = ''
     189                    level_gpa = ''
     190                    failed_courses = ''
     191                    not_taken_courses = ''
     192                    cum_credits_taken = ''
     193                    cum_credits_passed = ''
     194            line = (
     195                    stud.matric_number,
     196                    fullname,
     197                    credits_counted,
     198                    credits_passed,
     199                    level_gpa,
     200                    failed_courses,
     201                    not_taken_courses,
     202                    cum_credits_taken,
     203                    cum_credits_passed,
     204                    cgpa,
     205                    remark,
     206                    )
     207            table.append(line)
     208        return sorted(table, key=lambda value:value[0])
    209209
    210210    def __init__(self, faccode, depcode, certcode, session, level,
     
    241241        self.creation_dt_string = self.creation_dt.astimezone(
    242242            getUtility(IKofaUtils).tzinfo).strftime("%Y-%m-%d %H:%M:%S %Z")
    243         self.data = get_students(faccode, depcode, certcode, session, level)
     243        self.data = self._get_students(faccode, depcode, certcode, session, level)
    244244
    245245    def create_pdf(self, job_id):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/raw_score_report.py

    r14601 r14605  
    3232from waeup.kofa.students.reports.student_statistics import (
    3333    StudentStatisticsReportPDFView)
    34 
    35 class IRawScoreReport(IReport):
    36 
    37     session = Attribute('Session to report')
    38     level = Attribute('Level to report')
    39     faccode = Attribute('Faculty to report')
    40     depcode = Attribute('Department to report')
    41     certcode = Attribute('Certificate to report')
    42     creation_dt_string = Attribute('Human readable report creation datetime')
    43 
    44 def excluded(level_obj):
    45     """Some universities may add further conditions to exclude
    46     students from reports. These conditions can be customized in
    47     this function.
    48     """
    49     return False
    50 
    51 def get_courses(faccode, depcode, certcode, session, level):
    52     """Method 1: Get certificate courses of a
    53     certain department/certificate at a certain level.
    54     """
    55     site = grok.getSite()
    56     course_codes = []
    57     department = site['faculties'][faccode][depcode]
    58     if certcode == 'all':
    59         for cert in department.certificates.values():
    60             for certcourse in cert.values():
    61                 if certcourse.level == level:
    62                     course_codes.append(certcourse.getCourseCode())
    63     else:
    64         certificate = site['faculties'][faccode][depcode].certificates[certcode]
    65         for certcourse in certificate.values():
    66             if certcourse.level == level:
    67                 course_codes.append(certcourse.getCourseCode())
    68     return course_codes
    69 
    70 def get_students(faccode, depcode, certcode, session, level, course_codes):
    71     """Get students in a certain department/certificate who registered courses
    72     in a certain session at a certain level.
    73 
    74     Returns a list of student data tuples.
    75     """
    76     cat = queryUtility(ICatalog, name="students_catalog")
    77     if certcode == 'all':
    78         certcode = None
    79     result = cat.searchResults(
    80         depcode = (depcode, depcode), faccode = (faccode, faccode),
    81         certcode = (certcode, certcode)
    82         )
    83     table = []
    84     for stud in result:
    85         if not stud['studycourse'].has_key(str(level)):
    86             continue
    87         if stud.state == GRADUATED:
    88             continue
    89         level_obj = stud['studycourse'][str(level)]
    90         if level_obj.level_session != session:
    91             continue
    92         if excluded(level_obj):
    93             continue
    94         scores = dict()
    95         for ticket in level_obj.values():
    96             if ticket.code in course_codes:
    97                 if ticket.total_score is not None:
    98                     scores[ticket.code] = (ticket.total_score, ticket.grade)
    99                 else:
    100                     scores[ticket.code] = ('Nil', '')
    101         fullname = textwrap.fill(stud.display_fullname, 26)
    102         line = (
    103                 stud.matric_number,
    104                 fullname,
    105                 scores,
    106                 )
    107         table.append(line)
    108     return sorted(table, key=lambda value:value[0])
    109 
    11034from reportlab.lib import colors
    11135from reportlab.lib.styles import getSampleStyleSheet
     
    17296    ]
    17397
     98class IRawScoreReport(IReport):
     99
     100    session = Attribute('Session to report')
     101    level = Attribute('Level to report')
     102    faccode = Attribute('Faculty to report')
     103    depcode = Attribute('Department to report')
     104    certcode = Attribute('Certificate to report')
     105    creation_dt_string = Attribute('Human readable report creation datetime')
     106
    174107@implementer(IRawScoreReport)
    175108class RawScoreReport(Report):
     
    183116    note = ""
    184117    signatures = None
     118
     119    def _excluded(self, level_obj):
     120        """Some universities may add further conditions to exclude
     121        students from reports. These conditions can be customized in
     122        this function.
     123        """
     124        return False
     125
     126    def _get_courses(self, faccode, depcode, certcode, session, level):
     127        """Method 1: Get certificate courses of a
     128        certain department/certificate at a certain level.
     129        """
     130        site = grok.getSite()
     131        course_codes = []
     132        department = site['faculties'][faccode][depcode]
     133        if certcode == 'all':
     134            for cert in department.certificates.values():
     135                for certcourse in cert.values():
     136                    if certcourse.level == level:
     137                        course_codes.append(certcourse.getCourseCode())
     138        else:
     139            certificate = site['faculties'][faccode][depcode].certificates[certcode]
     140            for certcourse in certificate.values():
     141                if certcourse.level == level:
     142                    course_codes.append(certcourse.getCourseCode())
     143        return course_codes
     144
     145    def _get_students(self, faccode, depcode, certcode, session, level, course_codes):
     146        """Get students in a certain department/certificate who registered courses
     147        in a certain session at a certain level.
     148
     149        Returns a list of student data tuples.
     150        """
     151        cat = queryUtility(ICatalog, name="students_catalog")
     152        if certcode == 'all':
     153            certcode = None
     154        result = cat.searchResults(
     155            depcode = (depcode, depcode), faccode = (faccode, faccode),
     156            certcode = (certcode, certcode)
     157            )
     158        table = []
     159        for stud in result:
     160            if not stud['studycourse'].has_key(str(level)):
     161                continue
     162            if stud.state == GRADUATED:
     163                continue
     164            level_obj = stud['studycourse'][str(level)]
     165            if level_obj.level_session != session:
     166                continue
     167            if self._excluded(level_obj):
     168                continue
     169            scores = dict()
     170            for ticket in level_obj.values():
     171                if ticket.code in course_codes:
     172                    if ticket.total_score is not None:
     173                        scores[ticket.code] = (ticket.total_score, ticket.grade)
     174                    else:
     175                        scores[ticket.code] = ('Nil', '')
     176            fullname = textwrap.fill(stud.display_fullname, 26)
     177            line = (
     178                    stud.matric_number,
     179                    fullname,
     180                    scores,
     181                    )
     182            table.append(line)
     183        return sorted(table, key=lambda value:value[0])
    185184
    186185    def __init__(self, faccode, depcode, certcode, session, level,
     
    221220        self.data = dict()
    222221        for level in self.past_levels:
    223             course_codes = get_courses(
     222            course_codes = self._get_courses(
    224223                faccode, depcode, certcode, session, level)
    225224            self.course_codes[level] = course_codes
    226             self.data[level] = get_students(
     225            self.data[level] = self._get_students(
    227226                faccode, depcode, certcode, session,
    228227                self.levelcode, course_codes)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/session_results_presentation.py

    r14601 r14605  
    3333from waeup.kofa.students.reports.student_statistics import (
    3434    StudentStatisticsReportPDFView)
    35 
    36 
    37 class ISessionResultsPresentation(ILevelReport):
    38 
    39     """ Same interface as for level session results presentation.
    40     """
    41 
    42 def excluded(level_obj):
    43     """Some universities may add further conditions to exclude
    44     students from reports. These conditions can be customized in
    45     this function.
    46     """
    47     return False
    48 
    49 def get_students(faccode, depcode, certcode, session, level=None):
    50     """Get students in a certain department, studying a certain programmen
    51     who registered courses in a certain session at a certain level.
    52 
    53     Returns a list of lists of student data tuples.
    54     """
    55     site = grok.getSite()
    56     cat = queryUtility(ICatalog, name="students_catalog")
    57     if certcode == 'all':
    58         certcode = None
    59     result = cat.searchResults(
    60         depcode = (depcode, depcode), faccode = (faccode, faccode),
    61         certcode = (certcode, certcode)
    62         )
    63     students_utils = getUtility(IStudentsUtils)
    64     table = list()
    65     for i in range(len(students_utils.gpa_boundaries)+1):
    66         # The last list is reserved for students with more than one
    67         # level in the same session.
    68         table.append([])
    69     for stud in result:
    70         if stud.state == GRADUATED:
    71             continue
    72         line = (stud.student_id,
    73                 stud.matric_number,
    74                 stud.display_fullname,
    75                 )
    76         if level != 0:
    77             if not stud['studycourse'].has_key(str(level)):
    78                 continue
    79             level_obj = stud['studycourse'][str(level)]
    80             if level_obj.level_session != session:
    81                 continue
    82             if excluded(level_obj):
    83                 continue
    84         else:
    85             itemcount = 0
    86             for item in stud['studycourse'].values():
    87                 if item.level_session == session:
    88                     level_obj = item
    89                     itemcount += 1
    90             if itemcount == 0:
    91                 # No level registered in this session
    92                 continue
    93             if itemcount > 1:
    94                 # Error: more than one level registered in this session
    95                 table[len(students_utils.gpa_boundaries)].append(line)
    96                 continue
    97         gpaclass = students_utils.getDegreeClassNumber(level_obj)
    98         table[gpaclass].append(line)
    99         for i in range(len(students_utils.gpa_boundaries)+1):
    100             if len(table[i]):
    101                 table[i] = sorted([value for value in table[i]],
    102                     key=lambda value: value[2])
    103     return table
    104 
    10535from reportlab.lib import colors
    10636from reportlab.lib.styles import getSampleStyleSheet
     
    12757    ('ALIGN', (3,1), (-1,-1), 'RIGHT'),
    12858    ]
     59
     60class ISessionResultsPresentation(ILevelReport):
     61    """ Same interface as for level session results presentation.
     62    """
    12963
    13064@implementer(ISessionResultsPresentation)
     
    14175
    14276    note = None
     77
     78    def _excluded(self, level_obj):
     79        """Some universities may add further conditions to exclude
     80        students from reports. These conditions can be customized in
     81        this function.
     82        """
     83        return False
     84
     85    def _get_students(self, faccode, depcode, certcode, session, level=None):
     86        """Get students in a certain department, studying a certain programmen
     87        who registered courses in a certain session at a certain level.
     88
     89        Returns a list of lists of student data tuples.
     90        """
     91        site = grok.getSite()
     92        cat = queryUtility(ICatalog, name="students_catalog")
     93        if certcode == 'all':
     94            certcode = None
     95        result = cat.searchResults(
     96            depcode = (depcode, depcode), faccode = (faccode, faccode),
     97            certcode = (certcode, certcode)
     98            )
     99        students_utils = getUtility(IStudentsUtils)
     100        table = list()
     101        for i in range(len(students_utils.gpa_boundaries)+1):
     102            # The last list is reserved for students with more than one
     103            # level in the same session.
     104            table.append([])
     105        for stud in result:
     106            if stud.state == GRADUATED:
     107                continue
     108            line = (stud.student_id,
     109                    stud.matric_number,
     110                    stud.display_fullname,
     111                    )
     112            if level != 0:
     113                if not stud['studycourse'].has_key(str(level)):
     114                    continue
     115                level_obj = stud['studycourse'][str(level)]
     116                if level_obj.level_session != session:
     117                    continue
     118                if self._excluded(level_obj):
     119                    continue
     120            else:
     121                itemcount = 0
     122                for item in stud['studycourse'].values():
     123                    if item.level_session == session:
     124                        level_obj = item
     125                        itemcount += 1
     126                if itemcount == 0:
     127                    # No level registered in this session
     128                    continue
     129                if itemcount > 1:
     130                    # Error: more than one level registered in this session
     131                    table[len(students_utils.gpa_boundaries)].append(line)
     132                    continue
     133            gpaclass = students_utils.getDegreeClassNumber(level_obj)
     134            table[gpaclass].append(line)
     135            for i in range(len(students_utils.gpa_boundaries)+1):
     136                if len(table[i]):
     137                    table[i] = sorted([value for value in table[i]],
     138                        key=lambda value: value[2])
     139        return table
    143140
    144141    def __init__(self, faccode, depcode, certcode, session, level,
     
    180177        self.creation_dt_string = self.creation_dt.astimezone(
    181178            getUtility(IKofaUtils).tzinfo).strftime("%Y-%m-%d %H:%M:%S %Z")
    182         self.data = get_students(faccode, depcode, certcode, session, level)
     179        self.data = self._get_students(faccode, depcode, certcode, session, level)
    183180
    184181    def create_pdf(self, job_id):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_level_report.py

    r14529 r14605  
    55from waeup.kofa.interfaces import IJobManager
    66from waeup.kofa.students.reports.level_report import (
    7     get_students, LevelReport, ILevelReport)
     7    LevelReport, ILevelReport)
    88from waeup.kofa.students.tests.test_catalog import CatalogTestSetup
    99from waeup.kofa.students.tests.test_browser import StudentsFullSetup
     
    6565        self._add_tickets()
    6666         # we can get a table with one student
    67         result = get_students('fac1', 'dep1', 'CERT1', 2010, 100)
     67        lr =  LevelReport('fac1', 'dep1', 'CERT1', 2010, 100)
     68        result = lr._get_students('fac1', 'dep1', 'CERT1', 2010, 100)
    6869        self.assertEqual(result,
    6970            [(u'1234', u'Bob Tester', 90, 30, '1.666',
     
    7172            90, 30, '1.666', '')])
    7273        # same result when selecting all certificates
    73         result = get_students('fac1', 'dep1', 'all', 2010, 100)
     74        result = lr._get_students('fac1', 'dep1', 'all', 2010, 100)
    7475        self.assertEqual(result,
    7576            [(u'1234', u'Bob Tester', 90, 30, '1.666',
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_raw_score_report.py

    r14505 r14605  
    1010from waeup.kofa.browser.tests.test_pdf import samples_dir
    1111from waeup.kofa.students.reports.raw_score_report import (
    12     get_students, RawScoreReport, IRawScoreReport,
    13     get_courses)
     12    RawScoreReport, IRawScoreReport)
    1413
    1514
     
    3736    def test_get_courses(self):
    3837        # we can get a list with one course code
    39         result = get_courses('fac1', 'dep1', 'CERT1', 2010, 100)
     38        rsr = RawScoreReport('fac1', 'dep1', 'CERT1', 2010, 100)
     39        result = rsr._get_courses('fac1', 'dep1', 'CERT1', 2010, 100)
    4040        self.assertEqual(result, [(u'Course1')])
    4141        return
     
    4343    def test_get_students(self):
    4444        # we can get a table with one student
    45         course_codes = get_courses('fac1', 'dep1', 'CERT1', 2010, 100)
    46         result = get_students('fac1', 'dep1', 'CERT1', 2010, 100, course_codes)
     45        rsr = RawScoreReport('fac1', 'dep1', 'CERT1', 2010, 100)
     46        course_codes = rsr._get_courses('fac1', 'dep1', 'CERT1', 2010, 100)
     47        result = rsr._get_students(
     48            'fac1', 'dep1', 'CERT1', 2010, 100, course_codes)
    4749        self.assertEqual(result,
    4850            [(u'1234', u'Bob Tester', {'Course1': (70, 'A')})])
    4951        self.student['studycourse']['100']['Course1'].score = None
    50         result = get_students('fac1', 'dep1', 'CERT1', 2010, 100, course_codes)
     52        result = rsr._get_students(
     53            'fac1', 'dep1', 'CERT1', 2010, 100, course_codes)
    5154        self.assertEqual(result,
    5255            [(u'1234', u'Bob Tester', {'Course1': ('Nil', '')})])
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_session_results_presentation.py

    r14514 r14605  
    66from waeup.kofa.interfaces import IJobManager
    77from waeup.kofa.students.reports.session_results_presentation import (
    8     get_students, SessionResultsPresentation, ISessionResultsPresentation)
     8    SessionResultsPresentation, ISessionResultsPresentation)
    99from waeup.kofa.students.tests.test_catalog import CatalogTestSetup
    1010from waeup.kofa.students.tests.test_browser import StudentsFullSetup
     
    2626
    2727    def test_get_students(self):
    28         result = get_students('fac1', 'dep1', 'CERT1', 2010, 100)
     28        sr = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
     29        result = sr._get_students('fac1', 'dep1', 'CERT1', 2010, 100)
    2930        self.assertEqual(result,
    3031            [[], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')], []])
     
    3233
    3334    def test_get_students_at_all_levels(self):
    34         result = get_students('fac1', 'dep1', 'CERT1', 2010, 0)
     35        sr = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
     36        result = sr._get_students('fac1', 'dep1', 'CERT1', 2010, 0)
    3537        self.assertEqual(result,
    3638            [[], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')], []])
     
    3840
    3941    def test_get_students_all_certs(self):
    40         result = get_students('fac1', 'dep1', 'all', 2010, 100)
     42        sr = SessionResultsPresentation('fac1', 'dep1', 'all', 2010, 100)
     43        result = sr._get_students('fac1', 'dep1', 'all', 2010, 100)
    4144        self.assertEqual(result,
    4245            [[], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')], []])
     
    4952        studylevel.level_session = 2010
    5053        self.student['studycourse']['200'] = studylevel
    51         result = get_students('fac1', 'dep1', 'CERT1', 2010, 0)
     54        sr = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
     55        result = sr._get_students('fac1', 'dep1', 'CERT1', 2010, 0)
    5256        self.assertEqual(result,
    5357            [[], [], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')]])
     
    5660    def test_get_students_without_scores(self):
    5761        self.student['studycourse']['100']['Course1'].score = None
    58         result = get_students('fac1', 'dep1', 'CERT1', 2010, 0)
     62        sr = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
     63        result = sr._get_students('fac1', 'dep1', 'CERT1', 2010, 0)
    5964        self.assertEqual(result,
    6065            [[], [], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')]])
     
    6267    def test_get_students_without_level_in_session(self):
    6368        self.student['studycourse']['100'].level_session = 2011
    64         result = get_students('fac1', 'dep1', 'CERT1', 2010)
     69        sr = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
     70        result = sr._get_students('fac1', 'dep1', 'CERT1', 2010)
    6571        self.assertEqual(result,
    6672            [[], [], [], [], [], [], []])
Note: See TracChangeset for help on using the changeset viewer.