# -*- coding: utf-8 -*-


# 해당하는 SelectedCoupleSet을 가져온다 filter로 검색하기때문에 리턴타입은 list 다
def get_selected_couple_set(final_fitting, season, style):

    return final_fitting.selectedcoupleset_set.filter(
                couple__boy_fitting__fitting_category__season=season,
                couple__boy_fitting__fitting_category__style=style,
                couple__girl_fitting__fitting_category__season=season,
                couple__girl_fitting__fitting_category__style=style,
            )


# select커플 예외처리 함수  해당하는 select커플의 값이 없으면 익셉션처리 후 False를 리턴
def get_selected_first_couple_exception(final_fitting, season, style):
    selected_set_list = get_selected_couple_set(final_fitting, season, style)
    try:
        selected_set = selected_set_list[0].couple
        return selected_set
    except:
        return False


# 해당하는 FavoriteCoupleSet을 가져온다 filter로 검색하기때문에 리턴타입은 list 다
def get_favorite_couple_set(final_fitting, season, style):

    return final_fitting.selectedfavoritecoupleset_set.filter(
                couple__boy_fitting__fitting_category__season=season,
                couple__boy_fitting__fitting_category__style=style,
                couple__girl_fitting__fitting_category__season=season,
                couple__girl_fitting__fitting_category__style=style,
            )