Example #1
0
def reset_collection(assignment_import, collection_type):
    if collection_type == COHORT_COLLECTION_TYPE:
        assignment = CohortAssignment()
        assignment.override_previous = True
        assignment.override_protected = True
        assignment.cohort_number = assignment_import.cohort
    elif collection_type == MAJOR_COLLECTION_TYPE:
        assignment = MajorAssignment()
        assignment.major_code = assignment_import.major

    assignment.assignment_type = "file"
    assignment.comments = assignment_import.comment
    assignment.user = assignment_import.created_by
    assignment.campus = assignment_import.campus
    assignment.quarter = assignment_import.quarter

    applicants_to_assign = []
    for imp_assignment in assignment_import.get_assignments():
        app = imp_assignment.get_application()
        applicants_to_assign.append(app)
        assignment.quarter = assignment_import.quarter

    assignment.applicants = applicants_to_assign

    client = AdSel()
    if collection_type == COHORT_COLLECTION_TYPE:
        return client.assign_cohorts_bulk(assignment)
    elif collection_type == MAJOR_COLLECTION_TYPE:
        return client.assign_majors(assignment)
Example #2
0
def submit_collection(assignment_import):
    (assignment_import, assignment) = _get_collection(assignment_import)
    client = AdSel()
    client.get_quarters()
    if isinstance(assignment_import, SyskeyImport):
        if assignment_import.cohort:
            if assignment_import.upload_filename is not None:
                return client.assign_cohorts_bulk(assignment)
            else:
                return client.assign_cohorts_manual(assignment)
        elif assignment_import.major and len(assignment_import.major) > 0:
            return client.assign_majors(assignment)
    else:
        return client.assign_purple_gold(assignment)