Changeset 17985 for main


Ignore:
Timestamp:
16 Jan 2025, 02:08:45 (8 hours ago)
Author:
Henrik Bettermann
Message:

CreateAllStudentsPage: Stop creation after 1000 students to avoid write
conflicts which sill occur even though transactions have formerly been
commited.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r17917 r17985  
    441.8.2.dev0 (unreleased)
    55=======================
     6
     7* `CreateAllStudentsPage`: Stop creation after 1000 students to avoid write
     8  conflicts which sill occur even though transactions have formerly been
     9  commited.
    610
    711* Implement `ExportPDFFinalClearanceSlip`.
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r17850 r17985  
    775775        n = 0
    776776        for result in results:
    777             n += 1
    778777            if container_only and result.__parent__ is not self.context:
    779778                continue
     779            n += 1
    780780            success, msg = result.createStudent(view=self)
    781781            if success:
     
    785785                    (result.applicant_id, self.url(result, 'manage'), msg))
    786786            if not n % 1000:
    787                 transaction.commit()
     787                # Stop after 1000 students to avoid write conflicts which sill
     788                # occur even though transactions have formerly been commited.
     789                break
     790        self.flash(_('Finished.'))
    788791        grok.getSite()['configuration'].maintmode_enabled_by = None
     792        self.n = n
    789793        self.successful = ', '.join(created)
    790794        self.failed = failed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/createallstudentspage.pt

    r14952 r17985  
    11<div i18n:domain="waeup.kofa">
    2   <tal:success condition="view/successful">
    3     <strong i18n:translate="">Successfully created records:</strong>
    4     <br />
    5     <div  tal:replace="structure view/successful">
    6     </div>
    7     <br />
    8   </tal:success>
     2  <span i18n:translate="">
     3    <span i18n:name="n" tal:replace="view/n">N</span> student records have been successfully created.
     4  </span>
     5  <br />
    96  <tal:fail condition="view/failed">
    107    <strong i18n:translate="">Failed records:</strong>
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_applicantcopier.py

    r17660 r17985  
    303303        self.browser.open(self.container_path + '/createallstudents')
    304304        self.assertFalse('Failed records' in self.browser.contents)
    305         self.assertTrue('Successfully created records' in self.browser.contents)
     305        self.assertTrue('1 student records have been successfully created.' in self.browser.contents)
    306306        logcontent = open(logfile).read()
    307307        self.assertTrue('applicants.browser.CreateAllStudentsPage - started in app%s' % session
     
    328328        self.applicant.course_admitted = self.certificate
    329329        self.browser.open(self.root_path + '/createallstudents')
    330         self.assertTrue('Successfully created records:' in self.browser.contents)
     330        self.assertTrue('1 student records have been successfully created.' in self.browser.contents)
    331331        logcontent = open(logfile).read()
    332332        self.assertTrue('applicants.browser.CreateAllStudentsPage - started in applicants'
Note: See TracChangeset for help on using the changeset viewer.