Ejemplo n.º 1
0
def question_multi():
    # 参加が1人なら、ゲーム不成立。
    chk_entry = Game.query.with_entities(
        Game.entry_user2).filter(Game.id == session['id']).all()
    if not chk_entry[0][0]:
        return redirect(url_for('failure_multi'))

    # 10問やってるなら、resultに送る
    if session['num'] > MAX_QUESTION:
        return redirect(url_for('result_multi'))

    num = session['num']
    correct = session['correct']
    selects = session['select']

    # クイズ用の曲をシリアライズして用意する
    correct_song, select_songs = Song.dump_question_song(correct, selects, num)

    session['correct_song'] = correct_song
    game = {
        'num':
        session['num'],
        'correct_song':
        correct_song,
        'select_song':
        select_songs,
        'limit_time':
        round(session['created_timestamp'] + START_WAITING_TIME +
              QUESTION_TIME * num + ANSWER_TIME * (num - 1)),
        'DISPLAY_TIME':
        DISPLAY_TIME,
    }

    return render_template('games/question_multi.html', game=game)
Ejemplo n.º 2
0
def question():
    # 10問やってるなら、resultに送る
    if session['num'] > MAX_QUESTION:
        return redirect(url_for('result'))

    num = session['num']
    correct = session['correct']
    selects = session['select']

    # クイズ用の曲をシリアライズして用意する
    correct_song, select_songs = Song.dump_question_song(correct, selects, num)

    session['correct_song'] = correct_song
    game = {
        'num': session['num'],
        'correct_song': correct_song,
        'select_song': select_songs
    }

    return render_template('games/question.html', game=game)