Пример #1
0
 def GET(self, request):
     """
     GET returns 200 with the current quarter Textbook
     """
     term = get_current_quarter(request)
     summer_term = ""
     if term.quarter == "summer":
         summer_term = get_current_summer_term(request)
     return self.respond(term.year, term.quarter, summer_term)
Пример #2
0
 def GET(self, request):
     """
     GET returns 200 with the current quarter Textbook
     """
     try:
         term = get_current_quarter(request)
         summer_term = ""
         if term.quarter == "summer":
             summer_term = get_current_summer_term(request)
         return self.respond(request, term.year, term.quarter, summer_term)
     except Exception:
         return handle_exception(logger, timer, traceback)
Пример #3
0
 def GET(self, request):
     """
     GET returns 200 with the current quarter Textbook
     """
     try:
         term = get_current_quarter(request)
         summer_term = ""
         if term.quarter == "summer":
             summer_term = get_current_summer_term(request)
         return self.respond(request, term.year, term.quarter, summer_term)
     except Exception:
         return handle_exception(logger, timer, traceback)
Пример #4
0
def get_current_summer_term_in_schedule(schedule, request):
    """
    If the summer terms needs to be displayed separately,
    return the current summer term
    """
    summer_term = ""
    if schedule.term.quarter == 'summer':
        if has_summer_quarter_section(schedule):
            if _must_displayed_separately(schedule):
                summer_term = get_current_summer_term(request)
            else:
                summer_term = "full-term"
    return summer_term
Пример #5
0
def summer_term_overlaped(request, given_section):
    """
    @return true if:
    1). this is not a summer quarter or
    2). the given_summer_term is overlaped with the
        current summer term in the request
    """
    current_summer_term = get_current_summer_term(request)
    if given_section is None or current_summer_term is None:
        return True
    return (given_section.is_same_summer_term(current_summer_term)
            or given_section.is_full_summer_term()
            and is_b_term(current_summer_term))
Пример #6
0
def get_current_summer_term_in_schedule(schedule, request):
    """
    If the summer terms needs to be displayed separately,
    return the current summer term
    """
    summer_term = ""
    if schedule.term.is_summer_quarter():
        if has_summer_quarter_section(schedule):
            if _must_displayed_separately(schedule):
                summer_term = get_current_summer_term(request)
            else:
                summer_term = "full-term"
    return summer_term
Пример #7
0
def summer_term_overlaped(request, given_section):
    """
    @return true if:
    1). this is not a summer quarter or
    2). the given_summer_term is overlaped with the
        current summer term in the request
    """
    current_summer_term = get_current_summer_term(request)
    if given_section is None or current_summer_term is None:
        return True
    return (given_section.is_same_summer_term(current_summer_term) or
            given_section.is_full_summer_term() and
            is_b_term(current_summer_term))
Пример #8
0
def get_registered_future_quarters(request):
    """
    Return the list of future quarters that
    has actively enrolled sections
    """
    next_quar_sche = get_next_quarter_schedule(request)
    next_autumn_sche = None
    if next_quar_sche and next_quar_sche.term.is_summer_quarter():
        next_autumn_sche = get_next_autumn_quarter_schedule(request)

    # MUWM-3010
    current = get_current_quarter(request)
    if current.is_summer_quarter():
        summer_term = get_current_summer_term(request)
        if is_a_term(summer_term):
            summer = get_current_quarter_schedule(request)
            next_autumn_sche = next_quar_sche
            next_quar_sche = summer

    return _get_registered_future_quarters(request, next_quar_sche,
                                           next_autumn_sche)
Пример #9
0
def get_registered_future_quarters(request):
    """
    Return the list of future quarters that
    has actively enrolled sections
    """
    next_quar_sche = get_next_quarter_schedule(request)
    next_autumn_sche = None
    if next_quar_sche and next_quar_sche.term.quarter == 'summer':
        next_autumn_sche = get_next_autumn_quarter_schedule(request)

    # MUWM-3010
    current = get_current_quarter(request)
    if current.quarter == "summer":
        summer_term = get_current_summer_term(request)
        if summer_term == "a-term":
            summer = get_current_quarter_schedule(request)
            next_autumn_sche = next_quar_sche
            next_quar_sche = summer

    return _get_registered_future_quarters(request,
                                           next_quar_sche,
                                           next_autumn_sche)