187 Add task endpoint for submitting no business#21
Conversation
leeky
left a comment
There was a problem hiding this comment.
A couple of comments, but otherwise looks good! ![]()
| resources :tasks, only: %i[index show create update] do | ||
| member do | ||
| post 'complete', to: 'tasks#complete' | ||
| post :no_business |
There was a problem hiding this comment.
Is it worth changing the similar complete route above? We have two styles of saying the same thing very close to each other.
|
|
||
| def no_business | ||
| task = Task.find(params[:id]) | ||
| submission = task.file_no_business! |
There was a problem hiding this comment.
This feels odd - it reads like you're setting a Submission to the result of an action on Task.
I was considering adding a last_submission scope on a Task (and exposing it via the API for that linking to a submission from a task story). You could then do:
task = Task.find(params[:id])
task = task.file_no_business!
submission = task.last_submissionAnother option might be to rename the file_no_business! method.
But then again, I'm not sure there's a better solution at the moment!
There was a problem hiding this comment.
yeah, I struggled with this also. let's look at it when you get in, see if we can find a neater way.
56b6b15 to
4458e46
Compare
A submission is required every month, regardless of whether the supplier had any business for the given framework. This endpoint will allow the frontend app to report a task as having had no business, so suppliers can fulfil their obligation to submit something.
4458e46 to
f46dd46
Compare
| def no_business | ||
| task = Task.find(params[:id]) | ||
| task.file_no_business! | ||
| submission = task.latest_submission |
There was a problem hiding this comment.
This feels much better to me.
A submission is required every month, regardless of whether the supplier
had any business for the given framework. This endpoint will allow the
frontend app to report a task as having had no business, so suppliers
can fulfil their obligation to submit something.