def create_team_submit(): final_nav_header = getSessionInfo() form_data = flask_request.form print(form_data) team_name = form_data.get("team_name") team_competition_id = form_data.get("team_competition_id") team_data = {'teamname': team_name, 'competition_id': team_competition_id} for i in range(1, 7): user_member_email_i = form_data.get("member_{}".format(i)) if user_member_email_i == '': user_member_email_i = ' ' team_data['team_member{}'.format(i)] = user_member_email_i try: CREATE_TEAM_1_GO(team_data) response, user_data = VALIDATE_USER_EMAIL( session['user_data']['useremail']) if response: session['user_data'] = user_data resp = make_response(redirect("/create_team_success")) except Exception as e: print(e) # return "Unable to register, please contact LKM team" resp = make_response(redirect("/create_team_error")) return resp
def view_team(): final_nav_header, session_info_data = getSessionInfo(True) current_member_email = '' if session_info_data: current_member_email = session_info_data['useremail'] team_name = session_info_data.get('team_name') if team_name and team_name.strip() == '': return redirect('/create_team') status, team_details = GET_TEAM_DETAIL(team_name) if not status: return redirect('/create_team') team_members = team_details.get('team_member_ids') team_members = [x.split('__')[0] for x in team_members] return render_template('team/view_team.html', title=get_app_title(), final_nav_header=final_nav_header, team_name=team_name, team_members=team_members) return redirect('/signin')
def learning_board(): final_nav_header = getSessionInfo() content_html = parseMarkdownLocal(constants.LEARNING_BOARD_MARKDOWN_FILE) return render_template('learning_board.html', title=get_app_title(), final_nav_header=final_nav_header, content_html=content_html)
def signout_confirm(): if "user_data" in session: final_nav_header = getSessionInfo() return render_template('signout.html', title=get_app_title(), final_nav_header=final_nav_header) return redirect("/signout")
def quiz_page_route(): final_nav_header = getSessionInfo() content_html = parseMarkdownLocal(constants.QUIZ_RULES_MARKDOWN_FILE) return render_template('quiz/quiz.html', title=get_app_title(), final_nav_header=final_nav_header, iframe_url=constants.QUIZ_IFRAME_URL, quiz_rules_html=content_html)
def discussion_page_view(): final_nav_header = getSessionInfo() content_html = parseMarkdownLocal(constants.DISCUSSION_RULES_MARKDOWN_FILE) return render_template('discussion_page.html', title=get_app_title(), final_nav_header=final_nav_header, iframe_url=constants.DISCUSSION_IFRAME_URL, discussion_rules_html=content_html)
def about_us(): final_nav_header = getSessionInfo() content_html = parseMarkdownLocal(constants.ABOUT_US_MARKDOWN_FILE) return render_template('terms/about_us.html', title=get_app_title(), final_nav_header=final_nav_header, content_html=content_html)
def terms_page_view(): final_nav_header = getSessionInfo() content_html = parseMarkdownLocal(constants.TERMS_RULES_MARKDOWN_FILE) return render_template('terms/terms_global.html', title=get_app_title(), final_nav_header=final_nav_header, content_html=content_html)
def faq_page(): final_nav_header = getSessionInfo() content_html = parseMarkdownLocal(constants.FAQ_MARKDOWN_FILE) return render_template('faq_global.html', title=get_app_title(), final_nav_header=final_nav_header, content_html=content_html)
def signup(): if "user_data" in session: return redirect("/competitions") final_nav_header = getSessionInfo() return render_template('signup.html', title=get_app_title(), final_nav_header=final_nav_header)
def competition_submission_success(competition_id): if "user_data" not in session: return redirect("/signin") final_nav_header = getSessionInfo() return render_template('success/competition_submission.html', title=get_app_title(), final_nav_header=final_nav_header, competition_id=competition_id)
def quiz_leaderboard(): final_nav_header = getSessionInfo() file_object = GET_S3_FILE(constants.QUIZ_LEADERBOARD_DATAFILE) df_top_10 = pd.read_csv(io.BytesIO(file_object)) top_10_list = df_top_10.to_dict('records') return render_template('quiz/quiz_leaderboard.html', title=get_app_title(), final_nav_header=final_nav_header, quiz_data=top_10_list)
def competition_detail_overview(competition_id): competition_response = __competition_detail_data(competition_id) final_nav_header = getSessionInfo() return render_template( 'competition_detail_overview.html', title=get_app_title(), final_nav_header=final_nav_header, tab_active={ "overview": "is-active", "leaderboard": "" }, competition_data=competition_response['dynamic_competition_data'])
def profile_update(): if "user_data" not in session: return redirect("/signin") final_nav_header = getSessionInfo() user_data = { "email": session['user_data']['useremail'], "username": session['user_data']['username'] } return render_template('profile_update.html', title=get_app_title(), final_nav_header=final_nav_header, user_data=user_data)
def create_team_view(): final_nav_header, session_info_data = getSessionInfo(True) print(final_nav_header, session_info_data) current_member_email = '' if session_info_data: current_member_email = session_info_data['useremail'] if session_info_data.get( 'team_id') and session_info_data['team_id'].strip() != '': return redirect('/view_team') return render_template('team/create_team.html', title=get_app_title(), final_nav_header=final_nav_header, current_member_email=current_member_email)
def competition(): final_nav_header = getSessionInfo() route_competition_detail = 'competition_detail_overview' flag_current_old = False if 'user_data' in session: response, user_data = VALIDATE_USER_EMAIL( session['user_data']['useremail']) session['user_data'] = user_data if 'user_data' in session and 'team_name' in session[ 'user_data'] and session['user_data']['team_name'].strip( ) is not '': team_success_flag, team_data = GET_TEAM_DETAIL( session['user_data']['team_name']) route_competition_detail = 'competition_detail' if team_success_flag: competition_status, competition_data = GET_COMPETITION_DETAIL( team_data["competition_id"]) competition_data = [competition_data] if not competition_status: competition_data = [] else: competition_data = [] else: competition_status, competition_data = GET_ALL_COMPETITION_DETAILS() competition_data = __filter_competition_data(competition_data) flag_current_old = True route_competition_detail = 'competition_detail_overview' if not competition_status: competition_data = [] return render_template('competition.html', title=get_app_title(), final_nav_header=final_nav_header, competition_data=competition_data, route_competition_detail=route_competition_detail, flag_current_old=flag_current_old)
def signup_success(): final_nav_header = getSessionInfo() return render_template('success/signup.html', title=get_app_title(), final_nav_header=final_nav_header)
def __competition_detail_data(competition_id): final_nav_header = getSessionInfo() competition_detail = GET_COMPETITION_DETAIL(competition_id) competition_detail_readme_overview_path = competition_detail[1][ 'competition_overview_readme'] competition_detail_readme_overview_parsed = parseMarkdown( competition_detail_readme_overview_path) competition_detail_readme_faq_path = competition_detail[1][ 'competition_faq_readme'] competition_detail_readme_faq_parsed = parseMarkdown( competition_detail_readme_faq_path) competition_data_readme_path = competition_detail[1][ 'competition_data_readme'] competition_data_readme_parsed = parseMarkdown( competition_data_readme_path) competition_submission_readme_path = competition_detail[1][ 'competition_submission_readme'] competition_submission_readme_parsed = parseMarkdown( competition_submission_readme_path) competition_leaderboard_readme_path = competition_detail[1][ 'competition_leaderboard_readme'] competition_leaderboard_readme_parsed = parseMarkdown( competition_leaderboard_readme_path) competition_leaderboard_readme_path = competition_detail[1][ 'competition_leaderboard_readme'] competition_leaderboard_readme_parsed = parseMarkdown( competition_leaderboard_readme_path) competition_detail_rules_readme_path = competition_detail[1][ 'competition_detail_rules_readme'] competition_detail_rules_readme_parsed = parseMarkdown( competition_detail_rules_readme_path) dynamic_competition_data = { "competition_detail": competition_detail[1], "competition_detail_faq_overview": Markup(competition_detail_readme_overview_parsed), "competition_detail_faq_readme": Markup(competition_detail_readme_faq_parsed), "competition_detail_data_readme": Markup(competition_data_readme_parsed), "competition_detail_submission_readme": Markup(competition_submission_readme_parsed), "competition_detail_leaderboard_readme": Markup(competition_leaderboard_readme_parsed), "competition_detail_rules_readme": Markup(competition_detail_rules_readme_parsed), } if session.get('user_data') and session['user_data']["userid"]: user_id = session['user_data']["userid"] user_submissions_detail = GET_USER_SUBMISSIONS_DETAIL( competition_id, str(user_id)) top_submissions_detail = GET_TOP_SUBMISSIONS_DETAIL(competition_id) dynamic_competition_data[ "user_submissions_detail"] = user_submissions_detail[1] dynamic_competition_data[ "top_submissions_detail"] = top_submissions_detail[1] print("user_submissions_detail ", user_submissions_detail) print("top_submissions_detail ", top_submissions_detail) print("competition_detail ", competition_detail) print("competition_detail_readme_overview_parsed") print(competition_detail_readme_overview_parsed) print("competition_detail_readme_faq_parsed") print(competition_detail_readme_faq_parsed) return { 'dynamic_competition_data': dynamic_competition_data, 'final_nav_header': final_nav_header }
def index(): final_nav_header = getSessionInfo() return render_template('index.html', title=get_app_title(), final_nav_header=final_nav_header)
def create_team_success(): final_nav_header = getSessionInfo() return render_template('success/create_team.html', title=get_app_title(), final_nav_header=final_nav_header)