Changeset 13031


Ignore:
Timestamp:
4 Jun 2015, 14:21:23 (9 years ago)
Author:
Henrik Bettermann
Message:

Implement session-specific course registration deadline and
late registration payment.

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

Legend:

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

    r13012 r13031  
    441.3.2.dev0 (unreleased)
    55=======================
     6
     7* Implement session-specific course registration deadline and
     8  late registration payment.
    69
    710* Remove quite old bug in `doImport`: Replace empty strings *and* lists with
  • main/waeup.kofa/trunk/docs/source/userdocs/students/browser.rst

    r13028 r13031  
    113113=====================
    114114
     115Register Courses
     116================
     117
    115118Using Activation Codes
    116119======================
  • main/waeup.kofa/trunk/docs/source/userdocs/students/interfaces.rst

    r13028 r13031  
    264264used for persistent storage of same-named attributes in the database.
    265265
     266The property attribute `course_registration_allowed` determines
     267whether course registration has ended. In the base package students
     268can proceed if they have paid late registration fee. The conditions
     269for course registration can be configured in custom packages.
     270
    266271`ICourseTicket`
    267272---------------
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py

    r11869 r13031  
    252252        title = _(u'Application Start Date'),
    253253        required = False,
    254         description = _('Example:') + u'2011-12-01 18:30:00+01:00',
     254        description = _('Example: ') + u'2011-12-01 18:30:00+01:00',
    255255        )
    256256
     
    258258        title = _(u'Application Closing Date'),
    259259        required = False,
    260         description = _('Example:') + u'2011-12-31 23:59:59+01:00',
     260        description = _('Example: ') + u'2011-12-31 23:59:59+01:00',
    261261        )
    262262
  • main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py

    r13029 r13031  
    696696        )
    697697
    698     current_coursereg_deadline = schema.Datetime(
    699         title = _(u'Current Course Registration Deadline'),
    700         required = False,
    701         description = _('Example: ') + u'2011-12-31 23:59:59+01:00',
    702         )
    703 
    704698    current_academic_session = schema.Choice(
    705699        title = _(u'Current Academic Session'),
     
    762756        )
    763757
     758    late_registration_fee = schema.Float(
     759        title = _(u'Late Course Registration Fee'),
     760        default = 0.0,
     761        required = False,
     762        )
     763
    764764    clearance_enabled = schema.Bool(
    765765        title = _(u'Clearance enabled'),
     
    774774        required = False,
    775775        default = [],
     776        )
     777
     778    coursereg_deadline = schema.Datetime(
     779        title = _(u'Current Course Registration Deadline'),
     780        required = False,
     781        description = _('Example: ') + u'2011-12-31 23:59:59+01:00',
    776782        )
    777783
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r13028 r13031  
    26822682                mapping = {'a':max_credits}), type="warning")
    26832683            return
     2684        if not self.context.course_registration_allowed:
     2685            self.flash(_(
     2686                "Course registration has ended. "
     2687                "Please pay the late registration fee."), type="warning")
     2688            #self.redirect(self.url(self.context))
     2689            return
    26842690        IWorkflowInfo(self.context.student).fireTransition(
    26852691            'register_courses')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r13012 r13031  
    578578    gpa_params = Attribute('GPA parameters for this level.')
    579579    cumulative_params = Attribute('Cumulative GPA and other cumulative parameters for this level')
     580    course_registration_allowed = Attribute('True if registerin courses is allowed')
    580581
    581582    level = schema.Choice(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py

    r13008 r13031  
    2121"""
    2222import grok
     23import pytz
     24from datetime import datetime
    2325from zope.component.interfaces import IFactory
    2426from zope.catalog.interfaces import ICatalog
     
    205207        return studylevelsource.factory.getTitle(self.__parent__, self.level)
    206208
     209    @property
     210    def course_registration_allowed(self):
     211        try:
     212            deadline = grok.getSite()['configuration'][
     213                    str(self.level_session)].coursereg_deadline
     214        except TypeError, KeyError:
     215            return True
     216        payment_made = False
     217        if len(self.student['payments']):
     218            for ticket in self.student['payments'].values():
     219                if ticket.p_category == 'late_registration' and \
     220                    ticket.p_session == self.level_session and \
     221                    ticket.p_state == 'paid':
     222                        payment_made = True
     223        if deadline and deadline < datetime.now(pytz.utc) and not payment_made:
     224            return False
     225        return True
     226
    207227    def addCourseTicket(self, ticket, course):
    208228        """Add a course ticket object.
     
    294314    def editable_by_lecturer(self):
    295315        try:
    296             cas = grok.getSite()['configuration'].current_academic_session
    297             if self.student.state == VALIDATED and self.student.current_session == cas:
     316            cas = grok.getSite()[
     317                'configuration'].current_academic_session
     318            if self.student.state == VALIDATED and \
     319                self.student.current_session == cas:
    298320                return True
    299321        except (AttributeError, TypeError): # in unit tests
     
    302324
    303325    def writeLogMessage(self, view, message):
    304         return self.__parent__.__parent__.__parent__.writeLogMessage(view, message)
     326        return self.__parent__.__parent__.__parent__.writeLogMessage(
     327            view, message)
    305328
    306329    @property
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r13012 r13031  
    194194        configuration.booking_fee = 123.4
    195195        configuration.maint_fee = 987.0
     196        configuration.late_registration_fee = 345.0
    196197        self.app['configuration'].addSessionConfiguration(configuration)
    197198
     
    31793180            in logcontent)
    31803181
     3182    def test_late_registration(self):
     3183        # Login
     3184        delta = timedelta(days=10)
     3185        self.app['configuration'][
     3186            '2004'].coursereg_deadline = datetime.now(pytz.utc) - delta
     3187        IWorkflowState(self.student).setState('school fee paid')
     3188        self.browser.open(self.login_path)
     3189        self.browser.getControl(name="form.login").value = self.student_id
     3190        self.browser.getControl(name="form.password").value = 'spwd'
     3191        self.browser.getControl("Login").click()
     3192        self.browser.open(self.payments_path)
     3193        self.browser.open(self.payments_path + '/addop')
     3194        self.browser.getControl(name="form.p_category").value = ['late_registration']
     3195        self.browser.getControl("Create ticket").click()
     3196        self.assertMatches('...ticket created...',
     3197                           self.browser.contents)
     3198        self.browser.open(self.payments_path)
     3199        ctrl = self.browser.getControl(name='val_id')
     3200        value = ctrl.options[0]
     3201        self.browser.getLink("Study Course").click()
     3202        self.browser.getLink("Add course list").click()
     3203        self.assertMatches('...Add current level 100 (Year 1)...',
     3204                           self.browser.contents)
     3205        self.browser.getControl("Create course list now").click()
     3206        self.browser.getLink("100").click()
     3207        self.browser.getLink("Edit course list").click()
     3208        self.browser.getControl("Register course list").click()
     3209        self.assertTrue('Course registration has ended. Please pay' in self.browser.contents)
     3210        self.student['payments'][value].approve()
     3211        self.browser.getControl("Register course list").click()
     3212        self.assertTrue('Course list has been registered' in self.browser.contents)
     3213        self.assertEqual(self.student.state, 'courses registered')
     3214
     3215
    31813216class StudentRequestPWTests(StudentsFullSetup):
    31823217    # Tests for student registration
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r12971 r13031  
    471471        elif category == 'transcript':
    472472            amount = academic_session.transcript_fee
     473        elif category == 'late_registration':
     474            amount = academic_session.late_registration_fee
    473475        if amount in (0.0, None):
    474476            return _('Amount could not be determined.'), None
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r12588 r13031  
    175175        'application': 'Application Fee',
    176176        'transcript': 'Transcript Fee',
     177        'late_registration': 'Late Course Registration Fee'
    177178        }
    178179
Note: See TracChangeset for help on using the changeset viewer.