Skip to content

Commit 84c36e0

Browse files
committed
Whitespace issues
1 parent 1fe61c4 commit 84c36e0

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

app.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
# WEBSITE_HOSTNAME exists only in production environment
1414
if 'WEBSITE_HOSTNAME' not in os.environ:
15-
# local development, where we'll use environment variables
16-
print("Loading config.development and environment variables from .env file.")
17-
app.config.from_object('azureproject.development')
15+
# local development, where we'll use environment variables
16+
print("Loading config.development and environment variables from .env file.")
17+
app.config.from_object('azureproject.development')
1818
else:
19-
# production
20-
print("Loading config.production.")
21-
app.config.from_object('azureproject.production')
19+
# production
20+
print("Loading config.production.")
21+
app.config.from_object('azureproject.production')
2222

2323
app.config.update(
2424
SQLALCHEMY_DATABASE_URI=app.config.get('DATABASE_URI'),
@@ -37,13 +37,13 @@
3737
@app.route('/', methods=['GET'])
3838
def index():
3939
print('Request for index page received')
40-
restaurants = Restaurant.query.all()
40+
restaurants = Restaurant.query.all()
4141
return render_template('index.html', restaurants=restaurants)
4242

4343
@app.route('/<int:id>', methods=['GET'])
4444
def details(id):
4545
restaurant = Restaurant.query.where(Restaurant.id == id).first()
46-
reviews = Review.query.where(Review.restaurant==id)
46+
reviews = Review.query.where(Review.restaurant == id)
4747
return render_template('details.html', restaurant=restaurant, reviews=reviews)
4848

4949
@app.route('/create', methods=['GET'])
@@ -95,20 +95,20 @@ def add_review(id):
9595
db.session.add(review)
9696
db.session.commit()
9797

98-
return redirect(url_for('details', id=id))
98+
return redirect(url_for('details', id = id))
9999

100100
@app.context_processor
101101
def utility_processor():
102102
def star_rating(id):
103-
reviews = Review.query.where(Review.restaurant==id)
103+
reviews = Review.query.where(Review.restaurant == id)
104104

105105
ratings = []
106-
review_count = 0;
106+
review_count = 0;
107107
for review in reviews:
108108
ratings += [review.rating]
109109
review_count += 1
110110

111-
avg_rating = sum(ratings)/len(ratings) if ratings else 0
111+
avg_rating = sum(ratings) / len(ratings) if ratings else 0
112112
stars_percent = round((avg_rating / 5.0) * 100) if review_count > 0 else 0
113113
return {'avg_rating': avg_rating, 'review_count': review_count, 'stars_percent': stars_percent}
114114

@@ -120,4 +120,4 @@ def favicon():
120120
'favicon.ico', mimetype='image/vnd.microsoft.icon')
121121

122122
if __name__ == '__main__':
123-
app.run()
123+
app.run()

0 commit comments

Comments
 (0)