예제 #1
0
파일: app.py 프로젝트: tyz1z/ubi
def get_review(recommendationid):
    # Get result from DB.
    init_dolphin()
    result = get_review_from_db(recommendationid)
    if result:
        return succeed(result)
    else:
        return fail("No such data.")
예제 #2
0
파일: app.py 프로젝트: tyz1z/ubi
def get_review_changes(appid):
    # Get parameters.
    start_date = request.args.get("start_date", "")
    end_date = request.args.get("end_date", "")
    # Check whether valid dates.
    try:
        time.strptime(start_date, "%Y-%m-%d")
        time.strptime(end_date, "%Y-%m-%d")
    except Exception as e:
        return fail(e)
    # Get results from DB.
    init_dolphin()
    results = get_review_changes_from_db(appid, start_date, end_date)
    if results:
        return succeed(results)
    else:
        return fail("No such data.")
예제 #3
0
파일: app.py 프로젝트: tyz1z/ubi
def get_review_result(appid):
    # Get parameters.
    window_length = request.args.get("window_length", "")
    window_end_date = request.args.get("window_end_date", "")
    # Check whether valid date and window length.
    try:
        time.strptime(window_end_date, "%Y-%m-%d")
        window_length = int(window_length)
        if window_length not in ACCEPTABLE_WINDOW_LENGTH:
            raise Exception("Window length unacceptable.")
    except Exception as e:
        return fail(e)
    # Get result from DB.
    init_dolphin()
    result = get_review_result_from_db(appid, window_length, window_end_date)
    if result:
        return succeed(result)
    else:
        return fail("No such data.")
예제 #4
0
파일: app.py 프로젝트: tyz1z/ubi
def detail(appid):
    init_dolphin()
    details = get_detail(appid)
    return render_template("detail.html", detail=details)
예제 #5
0
파일: app.py 프로젝트: tyz1z/ubi
def index():
    init_dolphin()
    apps = get_apps()
    return render_template("home.html", apps=apps)