def school_customized_index():

    form = SchoolCustomizedForm()
    form.qa_resource.data = session['qa_resource']
    form.username.data = session['username']
    form.password.data = session['password']

    jira_account = {}
    jira_account['username'] = session['username']
    jira_account['password'] = session['password']
    jira = JiraHelper(config.jira_options, jira_account)

    if request.method == "POST":
        if form.submit.data and form.validate():
            project = request.form.getlist("check")
            session['project_name'] = project

            sprint_choice = []
            html_sprint_choice = []
            if len(project) > 0:
                for p in project:
                    session["board_id"] = config.s_dict[p.upper()]
                    # Return 10 sprint based on given board id
                    temp_sprint_choice = jira.get_num_of_sprint_names_by_board_id(
                        config.s_dict[p.upper()])
                    for l in temp_sprint_choice:
                        if l not in sprint_choice:
                            sprint_choice.append(l)
                for l in sprint_choice:
                    html_sprint_choice.append((l, l))

                html_sprint_choice.append(('-1', 'Please select a sprint'))
                session['sprint_name'] = html_sprint_choice
                return redirect(url_for('get_sprint_list'))
            else:
                return render_template('school_customized_index.html',
                                       form=form)
        else:

            return render_template('school_customized_index.html', form=form)

    elif request.method == "GET":
        return render_template('school_customized_index.html', form=form)

    return render_template('school_customized_index.html', form=form)
def school_customized_index():

    form = SchoolCustomizedForm()
    form.qa_resource.data = session['qa_resource']
    form.username.data = session['username']
    form.password.data = session['password']

    jira_account = {}
    jira_account['username'] = session['username']
    jira_account['password'] = session['password']
    jira = JiraHelper(config.jira_options, jira_account)

    if request.method == "POST" :
        if form.submit.data and form.validate():
            project = request.form.getlist("check")
            session['project_name'] = project

            sprint_choice = []
            html_sprint_choice = []
            if len(project) > 0:
                for p in project:
                    session["board_id"] = config.s_dict[p.upper()]
                    # Return 10 sprint based on given board id
                    temp_sprint_choice = jira.get_num_of_sprint_names_by_board_id(config.s_dict[p.upper()])
                    for l in temp_sprint_choice:
                        if l not in sprint_choice:
                            sprint_choice.append(l)
                for l in sprint_choice:
                    html_sprint_choice.append((l, l))

                html_sprint_choice.append(('-1', 'Please select a sprint'))
                session['sprint_name'] = html_sprint_choice
                return redirect(url_for('get_sprint_list'))
            else:
                return render_template('school_customized_index.html', form=form)
        else:

            return render_template('school_customized_index.html', form=form)

    elif request.method == "GET":
        return render_template('school_customized_index.html', form=form)

    return render_template('school_customized_index.html', form=form)