Page MenuHomePhabricator

Withdrawn applications shouldn't cause a server error
Closed, ResolvedPublic

Description

Application 13395 was withdrawn, marking it as invalid. The page for the application now causes a server error when it should not.

On the application page we calculate the number of days the application has been open via get_num_days_open. If the application isn't currently pending or under discussion, we calculate the time difference between when it was closed and when it was opened. Invalid applications don't set a closing date and therefore this calculation causes a server error.

Related Objects

Event Timeline

Yes! Let me know if you have any questions.

Hi I have checked for date_closed and get_num_days_open both of these are working fine when we mark an application INVALID
Can you share the error traceback for the application, maybe there is some other reason why it is giving server error.

Hi @amrit, thanks for looking into this. Here's some more details:

TypeError:unsupported operand type(s) for -: 'NoneType' and 'datetime.date'
...
File "TWLight/applications/models.py", line 308, in get_num_days_open

From looking at the application which causes this error, I can see that it has no data for date_closed or days_open. It was a waitlisted application for the MGG Online stream of RILM.

Hope that helps you investigate :)

Hi! I have tried multiple operations but could not regenerate this error on my local. Please tell me the steps to regenerate this error.
Tried creating an application for a WAITLISTED partner and then set its status to INVALID but that is also working fine. That one also had the date_closed and days_open values.

Hi @amrit - thanks for looking into this. I'm not sure what the relevant steps for reproducing the error are.

I'll play around with this a little today and see if I can get reproduction steps.

Thanks, that would be very helpful. :)

@amrit I figured out how to reproduce this error - it's when a user withdraws their application. The relevant code for that is at https://github.com/WikipediaLibrary/TWLight/blob/master/TWLight/users/views.py#L766, where we only change the application's status.

Thanks a lot @Samwalton9, will update you soon.

Hi @Samwalton9 I have raised a PR for this at https://github.com/WikipediaLibrary/TWLight/pull/815.
Thanks for your guidance and suggestions without that it wouldn't have been possible for me :)

Samwalton9-WMF renamed this task from Invalid applications shouldn't cause a server error to Withdrawn applications shouldn't cause a server error.Sep 20 2021, 9:54 AM
Samwalton9-WMF moved this task from Ready to Review on the The-Wikipedia-Library (Kanban) board.
Samwalton9-WMF updated the task description. (Show Details)