Ignore:
Timestamp:
5 Oct 2021, 10:30:09 (3 years ago)
Author:
Henrik Bettermann
Message:

OutstandingCoursesExporter: Remove passed courses from outstanding courses lists.

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

Legend:

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

    r16431 r16662  
    148148            student.get('studycourse', None), 'certificate', None)
    149149        if certificate:
    150             allticketcodes = []
    151             failedticketcodes = '' # taken but failed
    152             nottakenticketcodes = '' # registered but not taken
    153             missedticketcodes = '' # not registered
     150            allticketcodes = list()
     151            failedticketcodes = list() # taken but failed
     152            nottakenticketcodes = list() # registered but not taken
     153            missedticketcodes = list() # not registered
     154            # collect failed, not taken and all courses
    154155            for level in student['studycourse'].values():
    155                 failedticketcodes += level.passed_params[4]
    156                 nottakenticketcodes += level.passed_params[5]
     156                failedticketcodes += level.passed_params[4].split()
     157                nottakenticketcodes += level.passed_params[5].split()
    157158                for ticket in level.values():
    158159                    allticketcodes.append(ticket.code)
     160            # check if failed or not taken courses have been passed later
     161            for code in failedticketcodes:
     162                if code in level.passed_params[6]:
     163                    failedticketcodes.remove(code)
     164            for code in nottakenticketcodes:
     165                if code in level.passed_params[6]:
     166                    nottakenticketcodes.remove(code)
     167            # collect missed tickets
    159168            for certcourse in certificate.values():
    160169                if certcourse.getCourseCode() not in allticketcodes:
    161                     missedticketcodes += '%s ' % certcourse.__name__
     170                    missedticketcodes.append(certcourse.__name__)
    162171            student_wo = (student, missedticketcodes,
    163172                          failedticketcodes, nottakenticketcodes)
     
    602611                value = getattr(context[0], name, None)
    603612            elif name == 'missed':
    604                 value = context[1]
     613                value = ' '.join(context[1])
    605614            elif name == 'failed':
    606                 value = context[2]
     615                value = ' '.join(context[2])
    607616            elif name == 'nottaken':
    608                 value = context[3]
     617                value = ' '.join(context[3])
    609618        return super(
    610619            OutstandingCoursesExporter, self).mangle_value(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py

    r16029 r16662  
    164164        credits_passed = 0
    165165        courses_not_taken = ''
     166        courses_passed = ''
    166167        for ticket in self.values():
    167168            if ticket.total_score is not None:
     
    176177                    passed += 1
    177178                    credits_passed += ticket.credits
     179                    courses_passed += '%s ' % ticket.code
    178180            else:
    179181                courses_not_taken += '%s ' % ticket.code
    180182        return (passed, failed, credits_passed,
    181183                credits_failed, courses_failed,
    182                 courses_not_taken)
     184                courses_not_taken, courses_passed)
    183185
    184186    @property
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r16609 r16662  
    10621062        self.assertEqual(
    10631063            self.student['studycourse']['100'].passed_params,
    1064             (1, 1, 13, 10, 'COURSE1 ', ''))
     1064            (1, 1, 13, 10, 'COURSE1 ', '', 'ANYCODE '))
    10651065        self.assertEqual(
    10661066            self.student['studycourse']['200'].passed_params,
    1067             (0, 0, 0, 0, '', 'COURSE1 '))
     1067            (0, 0, 0, 0, '', 'COURSE1 ', ''))
    10681068        # And also cumulative params can be calculated. Meanwhile we have the
    10691069        # following courses: COURSE1 and COURSE2 in level 100 and
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r16333 r16662  
    890890            result,
    891891            'student_id,matric_number,certcode,display_fullname,missed,failed,nottaken\r\n'
    892             'A111111,234,CERT1,Anna M. Tester,C2_400 ,C3 ,C1 CRS1 \r\n'
     892            'A111111,234,CERT1,Anna M. Tester,C2_400,C3,C1 CRS1\r\n'
    893893            )
    894894        return
Note: See TracChangeset for help on using the changeset viewer.