Crucially, this design means that workers who do not complete the whole task are not paid. In batches.ts, the payBonus() call happens in receiveSurvey(), which means that we only pay users after we receive their final survey.
A better design might require some more substantial rearchitecting of how this would work.
Rather than calculating a fixed time, each user should have a person timer of how much time they're spending in the client. Then, that time should get passed back to us, and we pay them upon them closing the client or the task ending (whichever comes first).
Currently, the way that time (and payment) is calculated under the hood is based on the "batchTime," which is a constant value calculated from the parameters that define the round (defined in utils.ts): https://github.com/StanfordHCI/bang/blob/8fef82a7ba08a8a66b3fd736123b32755fbde15b/server/controllers/utils.ts
That amount is then converted to a fixed wage for users who complete the task in batches.ts: https://github.com/StanfordHCI/bang/blob/8fef82a7ba08a8a66b3fd736123b32755fbde15b/server/controllers/batches.ts
Crucially, this design means that workers who do not complete the whole task are not paid. In batches.ts, the payBonus() call happens in receiveSurvey(), which means that we only pay users after we receive their final survey.
A better design might require some more substantial rearchitecting of how this would work.