示例#1
0
def addflight():
    if f.verifLog():

        #Ajout vol

        idUtilisateur = session["idUtilisateur"]
        num_avion = request.form['select_avion']
        dir_vent = request.form['vent_dir']
        vit_vent = request.form['vent_vit']
        date = request.form['date']
        type_vol = request.form['select_type']
        new_flight = [num_avion, date, idUtilisateur, vit_vent, dir_vent, type_vol]
        b.ajout_vol(new_flight)

        #Ajout étapes

        idVol = b.get_idVol(idUtilisateur)
        vol = idVol[0][0]
        etapes = request.form['etapes']
        if len(etapes)<2:
            return render_template("new_route.html", data=b.getaerodrome(), avion=b.getNomAvion(), info="pbEtape")
        else:
            b.ajout_etapes(vol,etapes)

            #Calculs pour les estimations

            dist, carb, coordonnees_generales = b.update_info(vol)

            #Data nécessaires pour la page recap
            liste_etapes = b.get_etapes(vol)
            data, conso_totale, dist_totale=b.conso_dist_etapes(liste_etapes,carb,dist)

            return render_template("recap.html", table=data, coord_map=coordonnees_generales, conso_totale=conso_totale, dist_totale=dist_totale, info=session["statut"])
    else:
        return redirect(url_for('/login'))
示例#2
0
def gestion():
    if f.verifLog():
        dicDataAvion = {}
        dicDataAerodrome = {}
        # Crée les dictionnaires de tout les ids et noms des avions et des aéroports
        session['avion'] = b.getNomAvion()
        session['aerodrome'] = b.getNomAerodrome()

        selectedAerodrome = None
        selectedAvion = None

        selectedAvion = request.form.get("selectedAvion")
        if selectedAvion == "":
            selectedAvion = None
        elif selectedAvion is not None:
            selectedAvion = int(selectedAvion)
            dicDataAvion = b.getDataAvion(selectedAvion)

        selectedAerodrome = request.form.get('selectedAerodrome')
        if selectedAerodrome == "":
            selectedAerodrome = None
        elif selectedAerodrome is not None:
            selectedAvion = request.form.get('selectedAvion')
            dicDataAerodrome = b.getDataAerodrome(selectedAerodrome)

        session['selectedAerodrome'] = selectedAerodrome
        session['selectedAvion'] = selectedAvion
        return render_template("gestion.html", dataAerodrome=dicDataAerodrome, dataAvion=dicDataAvion, info=None)
    else:
        redirect(url_for('login'))
示例#3
0
def addcomment():
    if f.verifLog():
        idUtilisateur = session["idUtilisateur"]
        msg = request.form['comment']
        b.add_comment(idUtilisateur,msg)
        data = b.get_comments()
        return render_template("comments.html", data=data)

    else:
        return redirect(url_for('/login'))
示例#4
0
def profile():
    if f.verifLog():
        f.profile()
        return render_template("profile.html")
    else:
        return redirect('/login')
示例#5
0
def comments():
    if f.verifLog():
        return render_template("comments.html", data=b.get_comments())
    else:
        return redirect('/login')
示例#6
0
def historic():
    if f.verifLog():
        return render_template("historic.html", data=b.get_histo(session["idUtilisateur"]))
    else:
        return redirect('/login')
示例#7
0
def new_route():
    if f.verifLog():
        return render_template("new_route.html", data=b.getaerodrome(), avion=b.getNomAvion())
    else:
        return redirect('/login')