MCPcopy Create free account
hub / github.com/RocketMap/RocketMap / get_valid_stat_input

Method get_valid_stat_input

pogom/app.py:206–240  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

204 origin_lng=lon)
205
206 def get_valid_stat_input(self):
207 duration = request.args.get("duration", type=str)
208 sort = request.args.get("sort", type=str)
209 order = request.args.get("order", type=str)
210 valid_durations = OrderedDict()
211 valid_durations["1h"] = {"display": "Last Hour", "value": timedelta(hours=1), "selected": ("SELECTED" if duration == "1h" else "")}
212 valid_durations["3h"] = {"display": "Last 3 Hours", "value": timedelta(hours=3), "selected": ("SELECTED" if duration == "3h" else "")}
213 valid_durations["6h"] = {"display": "Last 6 Hours", "value": timedelta(hours=6), "selected": ("SELECTED" if duration == "6h" else "")}
214 valid_durations["12h"] = {"display": "Last 12 Hours", "value": timedelta(hours=12), "selected": ("SELECTED" if duration == "12h" else "")}
215 valid_durations["1d"] = {"display": "Last Day", "value": timedelta(days=1), "selected": ("SELECTED" if duration == "1d" else "")}
216 valid_durations["7d"] = {"display": "Last 7 Days", "value": timedelta(days=7), "selected": ("SELECTED" if duration == "7d" else "")}
217 valid_durations["14d"] = {"display": "Last 14 Days", "value": timedelta(days=14), "selected": ("SELECTED" if duration == "14d" else "")}
218 valid_durations["1m"] = {"display": "Last Month", "value": timedelta(days=365 / 12), "selected": ("SELECTED" if duration == "1m" else "")}
219 valid_durations["3m"] = {"display": "Last 3 Months", "value": timedelta(days=3 * 365 / 12), "selected": ("SELECTED" if duration == "3m" else "")}
220 valid_durations["6m"] = {"display": "Last 6 Months", "value": timedelta(days=6 * 365 / 12), "selected": ("SELECTED" if duration == "6m" else "")}
221 valid_durations["1y"] = {"display": "Last Year", "value": timedelta(days=365), "selected": ("SELECTED" if duration == "1y" else "")}
222 valid_durations["all"] = {"display": "Map Lifetime", "value": 0, "selected": ("SELECTED" if duration == "all" else "")}
223 if duration not in valid_durations:
224 valid_durations["1d"]["selected"] = "SELECTED"
225 valid_sort = OrderedDict()
226 valid_sort["count"] = {"display": "Count", "selected": ("SELECTED" if sort == "count" else "")}
227 valid_sort["id"] = {"display": "Pokedex Number", "selected": ("SELECTED" if sort == "id" else "")}
228 valid_sort["name"] = {"display": "Pokemon Name", "selected": ("SELECTED" if sort == "name" else "")}
229 if sort not in valid_sort:
230 valid_sort["count"]["selected"] = "SELECTED"
231 valid_order = OrderedDict()
232 valid_order["asc"] = {"display": "Ascending", "selected": ("SELECTED" if order == "asc" else "")}
233 valid_order["desc"] = {"display": "Descending", "selected": ("SELECTED" if order == "desc" else "")}
234 if order not in valid_order:
235 valid_order["desc"]["selected"] = "SELECTED"
236 valid_input = OrderedDict()
237 valid_input["duration"] = {"display": "Duration", "items": valid_durations}
238 valid_input["sort"] = {"display": "Sort", "items": valid_sort}
239 valid_input["order"] = {"display": "Order", "items": valid_order}
240 return valid_input
241
242 def get_stats(self):
243 return render_template('statistics.html',

Callers 2

raw_dataMethod · 0.95
get_statsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected