Example #1
0
def import_report_category():
    print 'Importing categories...'
    ReportCategory.objects.all().delete()

    cat_order = 1
    categories = set()
    for a in applicants:
        name = ReportCategory.get_category_name_from_first_name(a['first_name'])
        if name not in categories:
            categories.add(name)
            rep_cat = ReportCategory(name=name, order=cat_order)
            rep_cat.save()
            cat_order += 1
            print name,
    print 'added.'
Example #2
0
def import_results():
    print 'Importing results...'

    app_order = 1
    for a in applicants:
        q_app = QualifiedApplicant()
        q_app.order = app_order
        q_app.ticket_number = a['ticket_number']
        q_app.first_name = a['first_name']
        q_app.last_name = a['last_name']
        q_app.category = ReportCategory.get_category_by_app_first_name(
            result_set_id, a['first_name'])
        submission_info = SubmissionInfo.find_by_ticket_number(a['ticket_number'])
        if submission_info == None:
            print 'TICKET:', a['ticket_number']
        applicant = submission_info.applicant
        q_app.applicant = applicant
        q_app.save()
        app_order += 1

        print a['ticket_number']