Masabi / clubhouse2-ruby

A Ruby gem for interacting with the Clubhouse V2 API, with support for complex queries and caching.
https://rubygems.org/gems/clubhouse2
12 stars 8 forks source link

Updating a story immediately on assignment is pretty dangerous. #13

Open vishaldpatel opened 4 years ago

vishaldpatel commented 4 years ago

Using the gem, I wanted to get a count of all stories: stories_without_estimate += 1 if (story.estimate == nil) && (story.story_type = 'feature')

As you can imaging by the story.story_type = 'feature' portion, the story's story_type was changed right away after the code was run for the first time.

By the time I caught the bug, it was too late. Would it be difficult to implement save and save! methods for saving stories instead of saving on assignment?

scarybot commented 4 years ago

Hi Vishal,

Sorry about your mishap. That's an interesting thought. Personally I don't much like 'shadowing' such as this, but there's no reason why we couldn't add this behaviour and enable it with configuration. Happy to take a PR if you fancy a go at it, or I might give it a go myself next week.

vishaldpatel commented 4 years ago

Hi James, no worries! I appreciate the quick reply, and the work on the Gem. Its all yours to update for now; I haven't touched Ruby code (apart from my awesome script!) in a little while.