AgileVentures / projectscope

MVP dashboard for ProjectScope, using new gems architecture developed by AV folks
2 stars 14 forks source link

Spikes metric retrieval from rails console #6

Closed tansaku closed 8 years ago

tansaku commented 8 years ago

fixes #5

tansaku commented 8 years ago

@armandofox I think that pretty much all the code for updating the metrics could be pulled into the ProjectMetrics gem itself - that would allow a lot of update boiler plate that would allow the gems to be shared across rails projects more easily - although maybe that's not a key goal ATM.

Either way, having just started on an acceptance test for viewing the metrics I think it might make more sense to have the MetricSample class store image and score values in the db and avoid all the memoization in the gem - we'd make the individual gem codes simpler ... and it would also make writing the acceptance tests a bit simpler. I also can't really understand the need for the refresh method. I would have thought we just create new MetricSamples each time we need a new sample and use the gem functionality to populate the new MetricSamples score and image data from the network.

Anyways, I'll do pull requests to show you want I mean. I'm off and online over the next week travelling, but I can get bits of coding done in the car, and will push up bits and pieces as back up as I go. Don't think of the PRs as intended to be merged in unless I explicitly say so, e.g. this current PR was me just sharing the code I needed to get the data round trip confirmed ...

armandofox commented 8 years ago

I think it would be fine if refresh and memoization were part of ProjectMetrics gem, if someone wants to do that.

i feel strongly the refresh-from-source method needs to be kept separate because the gem itself is not in a position to know when is a good time to refresh itself, so it needs to expose that as an explicit service call. that also simplifies acceptance testing by allowing the majority of tests to run with factoried or fixtured data without doing any special stubbing.