Skip to content

Commit

Permalink
Improve formatting of the project
Browse files Browse the repository at this point in the history
  • Loading branch information
flofriday committed Feb 12, 2024
1 parent ceee620 commit bc9ac13
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
6 changes: 3 additions & 3 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def static_asset(path):

@app.route("/verify")
def verify():
url = request.args.get("url")
if url is None:
url = request.args.get("url").strip()
if url is None or url == "":
return "No url provided", 400

# A better error message if the submitted url is not of the icalendar but
Expand All @@ -88,7 +88,7 @@ def verify():
except ValueError:
return "TISS didn't return an ical file, did you paste the correct url?", 400
except Exception:
return "Somthing unexpected went wrong, maybe create an GitHub issue?", 500
return "Something unexpected went wrong, maybe create an GitHub issue?", 500

return "Ok"

Expand Down
8 changes: 4 additions & 4 deletions app/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ def improve_calendar(
component.add("location", event.address)

# Serialize the description
if locale == "en":
plain_description = event.plain_description_en()
html_description = event.html_description_en()
else:
if locale == "de":
plain_description = event.plain_description_de()
html_description = event.html_description_de()
else:
plain_description = event.plain_description_en()
html_description = event.html_description_en()

component.pop("description")
if google_cal:
Expand Down
3 changes: 2 additions & 1 deletion app/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def get_chart_data(db: Connection) -> list[Tuple[str, int]]:
COUNT(DISTINCT token_hash) AS 'daily',
(SELECT COUNT(DISTINCT token_hash)
FROM statistics s2
WHERE Date(s2.date) <= s.date AND s2.date >= DATE( s.date, '-30 days')
WHERE Date(s2.date) <= s.date
AND s2.date >= DATE( s.date, '-30 days')
) AS 'monbthly',
(SELECT COUNT(DISTINCT token_hash)
FROM statistics s3
Expand Down
10 changes: 8 additions & 2 deletions app/resources/generate_rooms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# This script creates the files rooms.csv.
# It does this automatically by the room UI from tiss and extracting the information from there.
# To run this you first need to: pip install selenium
# It does this automatically by the room UI from tiss and extracting the
# information from there.
# To run this enter the following:
# python3 -m venv venv
# source venv/bin/activate
# pip install -r requirements.txt
# python generate_rooms.py

import csv

from selenium import webdriver
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ branch = true
source = ["app"]

[tool.ruff.lint]
select = ["F", "UP", "B", "SIM", "I"]
select = ["E", "F", "UP", "B", "SIM", "I"]

0 comments on commit bc9ac13

Please sign in to comment.