Skip to content

Commit 164ac7d

Browse files
committed
Fix landing
1 parent 927bdff commit 164ac7d

File tree

6 files changed

+27
-25
lines changed

6 files changed

+27
-25
lines changed

Diff for: app/blueprints/catalog/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def ratings(name: str):
6767
def term():
6868
"""
6969
Code for academic term (to specify in class search)<br>
70-
required: <code>quarter</code> (str) and/or <code>year</code> (int).
70+
required: <code>quarter</code> (str) and/or <code>year</code> (int)
7171
"""
7272
inbound = condense_args(request, True)
7373
return get_term(inbound)

Diff for: app/blueprints/food/__init__.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ def index():
2323

2424
@bp.route("/locations")
2525
def locations():
26-
"""
27-
Details for all locations
28-
"""
26+
"""Details for all locations"""
2927
locs = foodDB.get("locs")
3028
return locs["value"]
3129
# return mult_waitz(locs["value"])
@@ -46,9 +44,7 @@ def locations_id(id: int):
4644
# TODO: allow enabling date argument
4745
@bp.route("/menus", methods=["GET"])
4846
def menus():
49-
"""
50-
Basic menu details for all locations
51-
"""
47+
"""Basic menu details for all locations"""
5248
menus = foodDB.get("menus")
5349
del menus["key"]
5450
return menus
@@ -76,9 +72,7 @@ def menus_id(id: int):
7672

7773
@bp.route("/items")
7874
def items():
79-
"""
80-
All food items
81-
"""
75+
"""All food items"""
8276
items = foodDB.get("items")
8377
del items["key"]
8478
return items
@@ -122,7 +116,7 @@ def items_search_name(name: str):
122116
@bp.route("/items/sum", methods=["GET", "POST"])
123117
def items_sum():
124118
"""
125-
Summed macros for items <br>
119+
Summed macros for items<br>
126120
required: <code>ids</code> (arr of str)
127121
"""
128122
inbound = condense_args(request, True)

Diff for: app/blueprints/home/helper.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from app import app
44

55

6+
# TODO: refactor
67
def get_index():
78
map, functions, rules = {}, app.view_functions, app.url_map.iter_rules()
89
color, hold = {"GET": "forestgreen", "POST": "dodgerblue"}, []
@@ -15,6 +16,8 @@ def get_index():
1516
"routes": {},
1617
}
1718
elif functions[i].__doc__:
19+
spl = functions[i].__doc__.split("Example: ")
20+
print(spl)
1821
route = f"/{'/'.join(str(j).split('/')[2:])}"
1922
dtype = search("<(.*):", route)
2023
default = True if dtype else False
@@ -25,12 +28,12 @@ def get_index():
2528
if k not in ["HEAD", "OPTIONS"]
2629
]
2730
map[f"/{split[0]}"]["routes"][route] = {
28-
"description": functions[i].__doc__.split(" E")[0],
31+
"description": spl[0],
2932
"methods": " ".join(sorted(methods, reverse=True)),
3033
}
31-
map[f"/{split[0]}"]["routes"][route] |= (
32-
{"default": functions[i].__doc__.split(": ")[1]} if default else {}
33-
)
34+
map[f"/{split[0]}"]["routes"][route] |= {
35+
"default": spl[1][:-5] if default else {}
36+
}
3437
hold.append(i)
3538
return map
3639

Diff for: app/blueprints/laundry/__init__.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,24 @@
1010

1111
@bp.route("/")
1212
def index():
13-
"""Provides residential laundry facility data."""
13+
"""Laundry Rooms"""
1414
return redirect(f"/#{request.blueprint}")
1515

1616

1717
# FIXME: obscenely long response time (~2-3 seconds)
1818
@bp.route("/rooms")
1919
def rooms():
20-
"""Retrieve data for all residential laundry facilities."""
20+
"""Details for all laundry rooms"""
2121
return update_rooms(laundryDB.get("rooms"))
2222

2323

2424
@bp.route("/rooms/<int:id>")
2525
def rooms_id(id: int):
26-
"""Retrieve data for a residential laundry facility. Specify an ID with <code>id</code> (integer). Example: 590391007"""
26+
"""
27+
Details for laundry room<br>
28+
required: <code>id</code> (int)
29+
Example: 590391007
30+
"""
2731
rooms = laundryDB.get("rooms")
2832
if rooms.get(str(id)):
2933
return update_rooms_id(str(id), rooms)

Diff for: app/blueprints/weather/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ def index():
1717

1818
@bp.route("/current")
1919
def current():
20-
"""Retrieve current weather data."""
20+
"""Retrieve current weather data"""
2121

2222
data = omw.get(
23-
f"/data/2.5/weather?lat=36.99&lon=-122.06&units=imperial&appid={app.config['OPENWEATHERMAP_KEY']}"
23+
f"/data/2.5/weather?lat=36.99&lon=-122.06&units=imperial&appid={app.config['OPENWEATHER_KEY']}"
2424
).json()
2525
sunrise = datetime.fromtimestamp(int(data["sys"]["sunrise"]))
2626
sunset = datetime.fromtimestamp(int(data["sys"]["sunset"]))

Diff for: app/templates/index.html

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
<h3>Access university data with ease!</h3>
66
<p>
77
The SlugTools API provides a standards-compliant interface that developers can use to access <b>UC Santa Cruz</b> data. It serves scraped and organized data across university sites and categories. Report any bugs/errors/issues <a href="https://github.slug.tools">here</a>.
8-
<hr style="visibility:hidden;" />
9-
All data is property of respective <a href="sources">sources</a>. Read up more on how this works <a href="https://github.slug.tools/api">here</a>.
108
</p>
119
<h1>Endpoints</h1>
12-
<p>All endpoints return JSON <code>{}</code></p>
10+
<p>
11+
All endpoints return JSON <code>{}</code>
12+
<br>Data is property of <a href="sources">Sources</a>
13+
</p>
1314
<script
1415
src="{{ url_for('static', filename='js/prompt.js') }}">
1516
</script>
@@ -19,9 +20,9 @@ <h3>{{ i }}</h3>
1920
{% for j in map[i]["routes"] %}
2021
<h4>
2122
{% if "<" in j %}
22-
<a onclick="promtpGo('{{ map[i]["routes"][j]["default"] }}', '{{ j.split('<')[1][:-1] }}', '{{ i }}{{ j.split('<')[0] }}')" style="cursor: pointer">{{ j.split()[0] }}</a>
23+
<a onclick="promtpGo('{{ map[i]["routes"][j]["default"] }}', '{{ j.split('<')[1][:-1] }}', '{{ i }}{{ j.split('<')[0] }}')" style="color: #0000EE; cursor: pointer">{{ j.split()[0] }}</a>
2324
{% else %}
24-
<a href={{ i + j }} style="text-decoration: none;">{{ j.split()[0] }}</a>
25+
<a href={{ i + j }} style="color: #0000EE; text-decoration:none;">{{ j.split()[0] }}</a>
2526
{% endif %}
2627
{{ map[i]["routes"][j]["methods"]|safe }}
2728
</h4>

0 commit comments

Comments
 (0)