[Feedback] #158
Checklist
-
I have prefixed the issue title with [Feedback]
along with a message pointing to the route or feature tested.- Example:
[Feedback] /packages/{name}
- Example:
-
I have completed the Changes section. -
I have completed the Bugs section. -
I have completed the Improvements section. -
I have completed the Summary section.
Changes
- FastAPI uses
/tu/{id}
, while PHP uses/tu/?id={id}
.
Bugs
- For requests generated by
schema/gendummydata.py
, opening two windows for a single open proposal (one on FastAPI and one in PHP, for example), clickingYes
(and as appearingNo
andAbstain
as well) in one window and then doing such in the other causes an exception is raised (#1). The window being served over FastAPI has to be clicked last. Any new reloads against said request also show the same error.
#1:
Traceback (most recent call last):
File "/aurweb/./aurweb/asgi.py", line 197, in add_security_headers
response = await util.error_or_result(call_next, request)
File "/aurweb/./aurweb/util.py", line 228, in error_or_result
response = await next(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/starlette/middleware/base.py", line 44, in call_next
raise app_exc
File "/usr/lib/python3.10/site-packages/starlette/middleware/base.py", line 34, in coro
await self.app(scope, request.receive, send_stream.send)
File "/usr/lib/python3.10/site-packages/starlette/middleware/base.py", line 63, in __call__
response = await self.dispatch_func(request, call_next)
File "/usr/lib/python3.10/site-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 172, in dispatch_middleware
raise e from None
File "/usr/lib/python3.10/site-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 169, in dispatch_middleware
response = await call_next(request)
File "/usr/lib/python3.10/site-packages/starlette/middleware/base.py", line 44, in call_next
raise app_exc
File "/usr/lib/python3.10/site-packages/starlette/middleware/base.py", line 34, in coro
await self.app(scope, request.receive, send_stream.send)
File "/usr/lib/python3.10/site-packages/starlette/exceptions.py", line 82, in __call__
raise exc
File "/usr/lib/python3.10/site-packages/starlette/exceptions.py", line 71, in __call__
await self.app(scope, receive, sender)
File "/usr/lib/python3.10/site-packages/starlette/routing.py", line 656, in __call__
await route.handle(scope, receive, send)
File "/usr/lib/python3.10/site-packages/starlette/routing.py", line 259, in handle
await self.app(scope, receive, send)
File "/usr/lib/python3.10/site-packages/starlette/routing.py", line 61, in app
response = await func(request)
File "/usr/lib/python3.10/site-packages/fastapi/routing.py", line 226, in app
raw_response = await run_endpoint_function(
File "/usr/lib/python3.10/site-packages/fastapi/routing.py", line 159, in run_endpoint_function
return await dependant.call(**values)
File "/aurweb/./aurweb/auth/__init__.py", line 181, in wrapper
return await _auth_required(True)(func)(*args, **kwargs)
File "/aurweb/./aurweb/auth/__init__.py", line 151, in wrapper
return await func(request, *args, **kwargs)
File "/aurweb/./aurweb/routers/trusted_user.py", line 170, in trusted_user_proposal
return render_proposal(request, context, proposal, voteinfo, voters, vote)
File "/aurweb/./aurweb/routers/trusted_user.py", line 123, in render_proposal
participation = (total / voteinfo.ActiveTUs) if total else 0
ZeroDivisionError: division by zero
Improvements
None noticed, but not much to improve on.
Summary
Works mostly as expected :)