예제 #1
0
def grading_terms():
    current_term = current_term_id()
    all_terms = term_ids_range(current_term, future_term_id())

    def _term_option(term_id):
        term_name = term_name_for_sis_id(term_id) + (
            ' (active)' if term_id == current_term else ' (future)')
        return {'name': term_name, 'value': term_id}

    return [_term_option(term_id) for term_id in all_terms]
예제 #2
0
def app_config():
    return tolerant_jsonify({
        'academicStandingDescriptions':
        ACADEMIC_STANDING_DESCRIPTIONS,
        'apptDeskRefreshInterval':
        app.config['APPT_DESK_REFRESH_INTERVAL'],
        'boacEnv':
        app.config['BOAC_ENV'],
        'currentEnrollmentTerm':
        current_term_name(),
        'currentEnrollmentTermId':
        int(current_term_id()),
        'defaultTermUnitsAllowed': {
            'max': 20.5,
            'min': 0.5,
        },
        'degreeCategoryTypeOptions':
        list(
            filter(
                lambda t: 'Placeholder' not in t and 'Campus' not in t,
                degree_progress_category_type.enums,
            ), ) + ['Campus Requirements'],
        'degreeProgressColorCodes':
        ACCENT_COLOR_CODES,
        'disableMatrixViewThreshold':
        app.config['DISABLE_MATRIX_VIEW_THRESHOLD'],
        'devAuthEnabled':
        app.config['DEVELOPER_AUTH_ENABLED'],
        'ebEnvironment':
        app.config['EB_ENVIRONMENT']
        if 'EB_ENVIRONMENT' in app.config else None,
        'ec2InstanceId':
        os.environ.get('EC2_INSTANCE_ID'),
        'featureFlagAdmittedStudents':
        app.config['FEATURE_FLAG_ADMITTED_STUDENTS'],
        'fixedWarningOnAllPages':
        app.config['FIXED_WARNING_ON_ALL_PAGES'],
        'futureTermId':
        int(future_term_id()),
        'googleAnalyticsId':
        app.config['GOOGLE_ANALYTICS_ID'],
        'isDemoModeAvailable':
        app.config['DEMO_MODE_AVAILABLE'],
        'maxAttachmentsPerNote':
        app.config['NOTES_ATTACHMENTS_MAX_PER_NOTE'],
        'pingFrequency':
        app.config['PING_FREQUENCY'],
        'supportEmailAddress':
        app.config['BOAC_SUPPORT_EMAIL'],
        'timezone':
        app.config['TIMEZONE'],
    })
예제 #3
0
파일: student.py 프로젝트: sandeepmjay/boac
def _construct_student_profile(student):
    if not student:
        return
    profiles = get_full_student_profiles([student['sid']])
    if not profiles or not profiles[0]:
        return
    profile = profiles[0]
    sis_profile = profile.get('sisProfile', None)
    if sis_profile and 'level' in sis_profile:
        sis_profile['level']['description'] = _get_sis_level_description(
            sis_profile)

    academic_standing = get_academic_standing_by_sid([student['sid']])
    if academic_standing:
        academic_standing = {
            term['termId']: term['status']
            for term in academic_standing.get(student['sid'])
        }

    enrollment_results = data_loch.get_enrollments_for_sid(
        student['sid'], latest_term_id=future_term_id())
    profile['enrollmentTerms'] = merge_enrollment_terms(
        enrollment_results, academic_standing=academic_standing)

    if sis_profile and sis_profile.get('withdrawalCancel'):
        profile['withdrawalCancel'] = sis_profile['withdrawalCancel']
        if not sis_profile['withdrawalCancel'].get('termId'):
            sis_profile['withdrawalCancel']['termId'] = current_term_id()

    advisors = profile.get('advisors', [])
    for index, advisor in enumerate(advisors):
        if advisor.get('sid') == 'UCBUGADHAAS':
            profile['advisors'][index][
                'firstName'] = 'Haas Undergraduate Program'
            profile['advisors'][index][
                'email'] = '*****@*****.**'
    return profile
예제 #4
0
def _construct_historical_student_profile(profile_rows):
    if not profile_rows or not profile_rows[0]:
        return

    profile = json.loads(profile_rows[0]['profile'])
    # As above, no photo information is expected but we still need a placeholder element in the feed.
    _merge_photo_urls([profile])
    enrollment_results = data_loch.get_historical_enrollments_for_sid(profile['sid'], latest_term_id=future_term_id())
    profile['enrollmentTerms'] = merge_enrollment_terms(enrollment_results)
    profile['fullProfilePending'] = True
    return profile
예제 #5
0
 def test_future_term_id_from_config(self, app):
     """Falls back on configured future term ID when not set to auto."""
     with override_config(app, 'CANVAS_FUTURE_ENROLLMENT_TERM', 'Summer 1969'):
         assert(sis_terms.future_term_id()) == '1695'
예제 #6
0
 def test_future_term_id(self):
     """Returns the future term id."""
     assert(sis_terms.future_term_id()) == '2182'