Closed carmichaelong closed 2 weeks ago
@AlbertoCasasOrtiz thanks for the catch (i should set up a local build at some point). pushed a commit that should fix the issue
It fixed it! I got then the same problem with processed_count and added a function too so it recognizes it.
Now, when I go to admin console, I got this:
File "C:\Workspaces\opencap\opencap-api\mcserver\admin.py", line 117, in formatted_duration
hours, remainder = divmod(int(obj.duration.total_seconds()), 3600)
AttributeError: 'Trial' object has no attribute 'duration'
[02/Oct/2024 11:13:48] "GET /admin/mcserver/trial/ HTTP/1.1" 500 452129
Looks like the obj.duration
inside of the formatted_duration function is not being recognized.
Thanks for checking that. Makes sense that it didn't work. I pushed a change because the field name is processed_duration
(rather than just duration
).
That solved the problem, but It was failing now complaining about total_seconds
.
Since processed duration can be null or blank, it could not access to the total_seconds()
for a non-defined object. I added an if-else (I returned the object as is without formatting in the case it is undefined, so check if that is what we want).
I just tested and it is showing the duration as expected for at least two trials:
Awesome, yes, that's the formatting that I was going for! LGTM.
shorten some column names and clean up duration formatting