File size: 2,343 Bytes
534863f
7100756
534863f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7100756
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
534863f
7100756
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from flask import Flask, render_template, request, redirect, url_for
from scripts.utils import listNeeds, generatePropositionExample, evaluateProposition


app = Flask(__name__)

@app.route("/")
def index():
    return render_template("index.html")

@app.route("/login")
def login():
    return render_template("login.html")

@app.route("/register")
def register():
    return render_template("register.html")

@app.route("/game")
def startGame():
    moneyNeeds,_ = listNeeds('money_needs')
    customerExpNeeds,_ = listNeeds('customer_exp')
    sustainabilityNeeds,_ = listNeeds('sustainability')
    return render_template("newGame.html", moneyNeeds=moneyNeeds, customerExpNeeds=customerExpNeeds, sustainabilityNeeds=sustainabilityNeeds)

@app.route("/generate-proposition",  methods = ['POST'])
def generateProposition():
   
    print("Proposition generated")
    productType = request.form['productType']
    productName = request.form['productName']  
    
    moneyNeeds = request.form.getlist('moneyNeeds')
    customerExpNeeds = request.form.getlist('customerExpNeeds')
    sustainabilityNeeds = request.form.getlist('sustainabilityNeeds')
    
    generatedProposition = generatePropositionExample(productName, productType, moneyNeeds, customerExpNeeds, sustainabilityNeeds)
    print(generatedProposition)
    return generatedProposition



@app.route("/submit-proposition",  methods = ['POST'])
def submitProposition():
    city = request.form['city']
    
    productType = request.form['productType']
    subcount1 = request.form['subcount1']
    subcount2 = request.form['subcount2']
    subcount3 = request.form['subcount3']
    productName = request.form['productName']
    
    
    moneyNeeds = request.form.getlist('moneyNeeds')
    customerExpNeeds = request.form.getlist('customerExpNeeds')
    sustainabilityNeeds = request.form.getlist('sustainabilityNeeds')
    proposition = request.form['proposition']
        
    matchingTopologies, predictedSubscriberTakeOut = evaluateProposition(city, productType, proposition, moneyNeeds, customerExpNeeds, sustainabilityNeeds)
    val = "matching topologies = {} and predictedSubscriberTakeOut = {}".format(",".join(matchingTopologies), predictedSubscriberTakeOut)
    print(val)
    return val


if __name__ == "__main__":
    app.run(debug=True, host="0.0.0.0", port=5000)