18F / tock

We use Tock to track and report our time at 18F
https://18f.gsa.gov/2015/05/21/TockingTime/
Other
120 stars 37 forks source link

bug: You cannot submit weekly billing for a project under hourly billing #1728

Closed cantsin closed 5 months ago

cantsin commented 6 months ago

During the last few weeks, we have repeatedly gotten user feedback in #tock that the following error sometimes comes up when submitting time cards:

image

There was an error processing your time card

  • You cannot submit weekly billing for a project under hourly billing.

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.

neilmb commented 6 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)?

cantsin commented 6 months ago

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 🙏🏻

neilmb commented 5 months ago

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.

Screenshot 2024-03-11 at 1 29 18 PM

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.