Beispiel #1
0
    def get(self):
        today = datetime.utcnow()
        training_programs = TrainingProgram.get_all_payable_for_date(today.year, today.month, today.day)
        for training_program in training_programs:
#            if not training_program.is_registration_closed:
            fees = training_program.get_fees_sorted()
            count = training_program.get_participant_count()

            current_fee = max([f.fee for f in fees])
            for fee in fees:
                if count <= fee.for_participant_count:
                    current_fee = fee.fee
                else:
                    continue
            training_program.final_price = current_fee
            training_program.put()

            for registrant in training_program.registrants:
                queue_mail_task(url='/worker/mail/training_announcement_payment_notification/',
                    params=dict(
                        registrant_key=str(registrant.key()),
                        training_program_key=str(training_program.key()),
                        current_fee=current_fee
                    ),
                    method='POST'
                )
Beispiel #2
0
    def get(self):
        from fee_calculation import calculate_fee
        
        today = datetime.utcnow()
        training_programs = TrainingProgram.get_all_payable_for_date(today.year, today.month, today.day)
        for training_program in training_programs:
            fees = training_program.get_fees_sorted_by_count()
            count = training_program.get_participant_count()
            current_fee = calculate_fee(fees, count)

            logging.info("fees: " + str(fees) + " count: " + str(count) + " current_fee: " + str(current_fee))
            training_program.final_price = current_fee
            training_program.is_payment_mail_queued = True
            training_program.put()

            for registrant in training_program.registrants:
                queue_mail_task(url='/worker/mail/training_announcement_payment_notification/',
                    params=dict(
                        registrant_key=str(registrant.key()),
                        training_program_key=str(training_program.key()),
                        current_fee=current_fee
                    ),
                    method='POST'
                )