dmbf29 / predictor-api

match prediction app / back-end API built on Rails
1 stars 4 forks source link

Update Predictions create and update actions to only allow upcoming matches #120

Closed trouni closed 3 months ago

trouni commented 3 months ago

Scope of this PR

This PR creates a new editable scope for predictions and uses it in the predictions#update action to prevent editing predictions on matches that are already started or finished.

Didn't look into error handling, just protecting this for now as it should definitely be prevented.

Notes

We should really add RSpec 😓

dmbf29 commented 3 months ago

I'm wondering if we should be validating it on the status or the actual kickoff time. Because we're reliant on the API to update the status, whereas we already know if a game as started technically.

trouni commented 3 months ago

@dmbf29 I think it would be reasonable to add a check on the time as well 👍