Ignore:
Timestamp:
4 Jun 2012, 11:30:01 (13 years ago)
Author:
Henrik Bettermann
Message:

Log updateEntry when importing study levels, course tickets and payment tickets.

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

Legend:

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

    r8581 r8626  
    442442        return studycourse.get(row['level'])
    443443
     444    def updateEntry(self, obj, row, site):
     445        """Update obj to the values given in row.
     446        """
     447        items_changed = super(StudentStudyLevelProcessor, self).updateEntry(
     448            obj, row, site)
     449        student = self.getParent(row, site).__parent__
     450        student.__parent__.logger.info(
     451            '%s - Study level updated: %s'
     452            % (student.student_id, items_changed))
     453        return
     454
    444455    def addEntry(self, obj, row, site):
    445456        parent = self.getParent(row, site)
     
    492503            return None
    493504        return level.get(row['code'])
     505
     506    def updateEntry(self, obj, row, site):
     507        """Update obj to the values given in row.
     508        """
     509        items_changed = super(CourseTicketProcessor, self).updateEntry(
     510            obj, row, site)
     511        student = self.getParent(row, site).__parent__.__parent__
     512        student.__parent__.logger.info(
     513            '%s - Course ticket updated: %s'
     514            % (student.student_id, items_changed))
     515        return
    494516
    495517    def addEntry(self, obj, row, site):
     
    561583            entry = payments.get('p' + p_id[6:])
    562584        return entry
     585
     586    def updateEntry(self, obj, row, site):
     587        """Update obj to the values given in row.
     588        """
     589        items_changed = super(StudentOnlinePaymentProcessor, self).updateEntry(
     590            obj, row, site)
     591        student = self.getParent(row, site).__parent__
     592        student.__parent__.logger.info(
     593            '%s - Payment ticket updated: %s'
     594            % (student.student_id, items_changed))
     595        return
    563596
    564597    def addEntry(self, obj, row, site):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r8491 r8626  
    150150        self.app['faculties']['fac1']['dep1'].certificates.addCertificate(
    151151            self.certificate)
     152
     153        self.logfile = os.path.join(
     154            self.app['datacenter'].storage, 'logs', 'students.log')
    152155        return
    153156
     
    647650        shutil.rmtree(os.path.dirname(fin_file))
    648651
     652        logcontent = open(self.logfile).read()
     653        # Logging message from updateEntry,
     654        self.assertTrue(
     655            'INFO - system - K1000000 - Study level '
     656            'updated: level=100, level_verdict=C, level_session=2009'
     657            in logcontent)
     658
    649659    def test_import_update(self):
    650660        # We perform the same import twice,
     
    741751        self.assertEqual(courseticket.semester, 1)
    742752        shutil.rmtree(os.path.dirname(fin_file))
     753
     754        logcontent = open(self.logfile).read()
     755        # Logging message from updateEntry,
     756        self.assertTrue(
     757            'INFO - system - K1000000 - Course ticket updated: code=COURSE1, '
     758            'mandatory=False, score=3'
     759            in logcontent)
    743760
    744761    def test_import_update(self):
     
    844861        shutil.rmtree(os.path.dirname(fin_file))
    845862
     863        logcontent = open(self.logfile).read()
     864        # Logging message from updateEntry,
     865        self.assertTrue(
     866            'INFO - system - K1000001 - Payment ticket updated: '
     867            'p_id=p1266236341955, p_item=BTECHBDT, '
     868            'creation_date=2010-02-15 13:19:01+00:00, r_code=00, '
     869            'r_amount_approved=19500.0, p_category=schoolfee, '
     870            'amount_auth=19500.0, p_state=paid'
     871            in logcontent)
     872
    846873    def test_import_update(self):
    847874        # We perform the same import twice,
Note: See TracChangeset for help on using the changeset viewer.