Hot answers tagged

3

The major thing I see is, the code is imperative. But things will be lot more easier to read and follow, if you practise declarative way of writing code. I would not name the class as DHHScoreChallenge. It should be ScoreChallenge, so that it can be used for any user that we pass in :) I would make the method getData private, in order to externalise the ...


1

First thing I'd like to tackle right away is the name convention for method names and variables. In ruby, we use underscore_style instead of camelCaseStyle - this makes a huge difference. Now, let's tackle the code itself. One thing that I see that could be improved here is the fact that you aren't leveraging the power of ruby collections and classes. So, ...


1

The first thing that I noticed that could be improved is to use find_each instead of all. all will load all the records from the database at once, which can blow up your server. Using find_each instead, you'll load records in batches. Also, another thing here is that you're using heavily object in queries, for instance: UserSegment.find_by(user: ...


Only top voted, non community-wiki answers of a minimum length are eligible