Example #1
0
def main():
    round_number = int(sys.argv[1])
    national_id = sys.argv[2]
    verification = sys.argv[3]
    amount = int(sys.argv[4])

    try:
        applicant = Applicant.objects.get(national_id=national_id)
    except:
        print "NAT NOT FOUND"
        quit()

    results = applicant.admission_results.filter(
        round_number=round_number).all()
    if len(results) != 0:
        result = results[0]
    else:
        result = None
    if result == None:
        print "ERROR (no admission result):", applicant, national_id
        quit()

    expected_verification = applicant.verification_number(
        settings.CONFIRMATION_HASH_MAGIC)
    if expected_verification != verification:
        print "ERROR (verification):", applicant, national_id, expected_verification, verification
        quit()

    confirmations = applicant.admission_confirmations.filter(
        round_number=round_number)
    if len(confirmations) != 0:
        print "ERROR (dup):", applicant, national_id, confirmations[
            0].paid_amount, confirmations[0].confirmed_at
        quit()

    confirmation = AdmissionConfirmation()
    confirmation.applicant = applicant
    confirmation.paid_amount = amount
    confirmation.round_number = round_number
    confirmation.save()
    print "DONE"
Example #2
0
def main():
    round_number = int(sys.argv[1])
    national_id = sys.argv[2]
    verification = sys.argv[3]
    amount = int(sys.argv[4])

    try:
        applicant = Applicant.objects.get(national_id=national_id)
    except:
        print "NAT NOT FOUND"
        quit()

    results = applicant.admission_results.filter(round_number=round_number).all()
    if len(results)!=0:
        result = results[0]
    else:
        result = None
    if result == None:
        print "ERROR (no admission result):", applicant, national_id
        quit()

    expected_verification = applicant.verification_number(settings.CONFIRMATION_HASH_MAGIC)
    if expected_verification != verification:
        print "ERROR (verification):", applicant, national_id, expected_verification, verification
        quit()

    confirmations = applicant.admission_confirmations.filter(round_number=round_number)
    if len(confirmations)!=0:
        print "ERROR (dup):", applicant, national_id, confirmations[0].paid_amount, confirmations[0].confirmed_at
        quit()

    confirmation = AdmissionConfirmation()
    confirmation.applicant = applicant
    confirmation.paid_amount = amount
    confirmation.round_number = round_number
    confirmation.save()
    print "DONE"
Example #3
0
                print "ERROR (no admission result):", applicant, national_id
                error_count += 1
                continue

            expected_verification = applicant.verification_number(
                settings.CONFIRMATION_HASH_MAGIC)

            if expected_verification != verification:
                print "ERROR (verification):", applicant, national_id, expected_verification, verification
                error_count += 1
                continue

            confirmations = applicant.admission_confirmations.filter(
                round_number=round_number)
            if len(confirmations) != 0:
                print "ERROR (dup):", applicant, national_id, confirmations[
                    0].paid_amount, confirmations[0].confirmed_at
                error_count += 1
                continue

            confirmation = AdmissionConfirmation()
            confirmation.applicant = applicant
            confirmation.paid_amount = amount
            confirmation.round_number = round_number
            confirmation.save()
            updated_count += 1
        else:
            print "ERROR: NAT ID NOT FOUND", national_id, ln

print updated_count, 'updated, with ', error_count, 'errors'
Example #4
0
            result = applicant.get_latest_admission_result()
            if result == None:
                print "ERROR (no admission result):", applicant, national_id
                error_count += 1
                continue

            expected_verification = applicant.verification_number(settings.CONFIRMATION_HASH_MAGIC)

            if expected_verification != verification:
                print "ERROR (verification):", applicant, national_id, expected_verification, verification
                error_count += 1
                continue

            confirmations = applicant.admission_confirmations.filter(round_number=round_number)
            if len(confirmations)!=0:
                print "ERROR (dup):", applicant, national_id, confirmations[0].paid_amount, confirmations[0].confirmed_at
                error_count += 1
                continue

            confirmation = AdmissionConfirmation()
            confirmation.applicant = applicant
            confirmation.paid_amount = amount
            confirmation.round_number = round_number
            confirmation.save()
            updated_count += 1
        else:
            print "ERROR: NAT ID NOT FOUND", national_id, ln

print updated_count, 'updated, with ', error_count, 'errors'