Closed cantsin closed 5 months ago
I'll look into this. Could it come from pre-filled time cards that lack some of the validation that went into #1575 (because they are getting made on the back end)?
That is indeed my hypothesis. It'd be nice to fix this problem once and for all so thank you for taking this one on 🙏🏻
I was able to extract the HTML page for the timecard page from one of the users experiencing this problem and it seems close to what we might have guessed. The POST request from that timecard page is sending "project_allocation" as zero instead of a blank.
In our code that handles this form submission https://github.com/18F/tock/blob/main/tock/hours/forms.py#L187 we check to see whether project_allocation
is the empty string, but since a 0 is being submitted here, we get the error seen above.
Still thinking about the right fix. Either add "0" to the check on that line or figure out why these are being sent as zeroes and prevent that from happening.
During the last few weeks, we have repeatedly gotten user feedback in
#tock
that the following error sometimes comes up when submitting time cards:We thought we fixed this over at https://github.com/18F/tock/issues/1575 but I think this problem has come up in a different form. In particular, this is now happening (but not exclusively so) for prefilled time cards -- that is, time cards that carry over from the previous week.
Not sure how to reproduce, yet, but we can start by looking at these affected users' time cards.