Open Jojo144 opened 3 months ago
Is it link to this? https://stackoverflow.com/questions/42457115/sqlalchemy-get-returns-none
I don't understand the answer really...
Thanks for the investigation. I don't understand the history code in details, sorry... Potentially, we manipulate old version of objects, and I don't know how it interacts with schema changes and migrations.
If I had to guess, I see two possibilities:
I checked who wrote that code, and it's you :smile: #1223 But the complexity comes from previous code, of course.
On my production server, history works well for new small projects. But for old projects I get "Internal Server Error" when I go on the history page. I didn't succeed in reproducing the bug on a small example in a dev environment.
After some investigations, I realized that
detailed_version.payer
anddetailed_version.owers
returns None here:https://github.com/spiral-project/ihatemoney/blob/710aee97115e501eb548b9e8b4a9713037af0793/ihatemoney/history.py#L96-L101
So if I replace
describe_version(detailed_version.payer))
bystr(Person.query.get(detailed_version.payer_id, project))
it works for the payer. I don't know how to do the same trick for owers.Any idea why the
payer
method returns None here?Any idea why the object
detailed_version
does not haveowers
attribute?Is it linked to the fact that this relationship is manually defined?
https://github.com/spiral-project/ihatemoney/blob/710aee97115e501eb548b9e8b4a9713037af0793/ihatemoney/models.py#L644-L649