Commit graph

402 commits

Author SHA1 Message Date
Don Cruse
9073fa1237 Removing some intermediate values
This removes some intermediate steps that were ultimately not necessary
to the math.  It also consolidates some of the methods for counting events
so that fewer intermediate values are necessary.

To that end, a new scope is added to the ToDo model for events that are
*either* created_at or completed_at after a certain date. This scope
allows the StatsController to pull out the largest possible responsive
set of values, and then filter just the particular slices that it needs
for various steps in the calculation.
2013-07-18 22:32:44 -05:00
Matt Rogers
c28ffd6763 Merge pull request #193 from mattdbridges/extract-rich-message
Extract behavior from Todo.from_rich_message
2013-07-18 20:12:03 -07:00
Matt Bridges
519e3df4d4 TodoFromRichMessage is really a service object 2013-07-18 16:41:28 -05:00
Colin Rymer
0a5936fecf use a null object like a boss 2013-07-18 16:37:34 -05:00
Matt Bridges
c2111b2f8e Extract behavior from Todo.from_rich_message
`Todo.from_rich_message` was partially tested from the MessageGateway,
but it is mostly untested and does not belong in Todo due to it's unique
nature. Extract it entirely from `Todo` into it's own dedicated object
for unit testing.
2013-07-18 16:35:51 -05:00
Colin Rymer
55e2f5b6a1 remove returns and clean up some conditionals 2013-07-18 16:03:18 -05:00
Colin Rymer
c71dc9afc9 remove boolean returning ternary expression 2013-07-18 15:22:46 -05:00
Colin Rymer
c5968b798c better leverage Hash#each for metaprogramming 2013-07-18 15:13:30 -05:00
Colin Rymer
332589163c metaprogramming and stylistic changes
- Use `define_method` to clean up definition of methods that only
   vary by the name of the day they reference and the corresponding
   numerical value.

 - Remove calls to self, explicit return statements, etc.
2013-07-18 15:01:02 -05:00
Colin Rymer
45df84b739 consolidate validates_presence_of validations 2013-07-18 14:10:14 -05:00
Reinier Balt
4a485558e2 Merge branch 'master' into rails4
Conflicts:
	Gemfile.lock
	config/routes.rb
2013-06-17 09:25:02 +02:00
Reinier Balt
56b884055f fix #1270. if start-from fits the recurrence pattern, the first todo should use the start-from date
this is use-case 2 mentioned in the ticket.
2013-06-11 23:38:30 +02:00
Reinier Balt
a8af880647 fix #1417. We now handle unblocking a todo that is part of a hidden project or context 2013-06-04 10:07:02 +02:00
Reinier Balt
671f64b419 move to strong_parameters of rails4. 2013-05-27 12:44:31 +02:00
Reinier Balt
54b106d96b remove use of .all on model 2013-05-13 12:33:01 +02:00
Reinier Balt
1234abb266 taggable_type should be accessible for test 2013-05-13 12:32:41 +02:00
Reinier Balt
ebff4cfc0c start fixing deprecation warnings 2013-05-11 23:13:32 +02:00
Reinier Balt
89cdfbc606 fix failing tests on ruby 1.9.3
funny, this is the first one not failing on 2.0.0 but failing on 1.9.3. Thanks for Travis!
2013-05-04 13:44:45 +02:00
Reinier Balt
5cfa115cdc small refactorings
fix passing params in use of _collection
2013-05-03 21:54:03 +02:00
Reinier Balt
f891ee86fe fix clearing show_from fails
caused by slightly different (better) workings of aasm
2013-05-03 19:28:26 +02:00
Matt Rogers
883ea2b968 Move Project#create_from_todo to its own class
The point of this is to keep as many things out of the ActiveRecord
objects as possible and use them as just a thin database abstraction
layer.
2013-05-02 22:30:24 -05:00
Matt Rogers
b1fb1dd326 Remove more duplication from Todos::Calendar. 2013-04-29 16:35:50 -05:00
Matt Rogers
fedfb55ff8 Remove extra whitespace 2013-04-29 15:24:32 -05:00
Reinier Balt
010d0e9ba0 refactor creating todos in todos_controller 2013-04-29 15:15:48 +02:00
Reinier Balt
5ed69fc1a2 update gems and fix failures from new aasm
I'm not sure the test failures caused by reload not working are caused by the new aasm, 
perhaps the thread isolation is causing that...
2013-04-29 11:53:32 +02:00
Reinier Balt
98f8cade5b fix finding the used in the message_gateway 2013-04-29 09:38:34 +02:00
Matt Rogers
8db5793bf6 Merge pull request #178 from TracksApp/rename-has-next-todo
Rename RecurringTodo#has_next_todo
2013-04-27 09:52:58 -07:00
Matt Rogers
ba38277df8 Add a Todos::Calendar object 2013-04-26 23:08:56 -05:00
Matt Rogers
c4bcc0996f Remove extra whitespace 2013-04-26 16:30:40 -05:00
Matt Rogers
88e7798db6 Rename RecurringTodo#has_next_todo to continues_recurring?
This clarifies the intent of the method.
2013-04-26 16:30:12 -05:00
Matt Rogers
036c34f266 Rename RecurringTodo#inc_occurences to increment_occurrences
This clarifies the method name and fixes a typo.
2013-04-26 16:20:42 -05:00
Matt Rogers & Katrina Owen
a1b270699d Extract creation of todos from recurrings todos 2013-04-25 20:45:14 -05:00
Katrina Owen
a4ae0c03bf Fix failing tests 2013-03-18 21:54:19 -06:00
Katrina Owen
a690e4a4cd Extract methods in pie chart data model 2013-03-18 19:57:42 -06:00
Katrina Owen
961227da0c Extract pie chart data logic into model layer
Move most of the tests for this logic into the unit test layer.
2013-03-18 19:49:54 -06:00
Reinier Balt
22b371ef8c do a big refactor of rendering collections of todos for home page, tag page, project page, context page 2013-03-18 12:36:40 +01:00
Matt Rogers
f541a4c9d6 Simplify SearchController#results
Give names to the various things being searched for and move them out
into their own methods. Also add scopes to give names to things being
queried out of the models.
2013-03-12 19:49:19 -05:00
Katrina Owen
3479585991 Use a more appropriate name for stats domain object 2013-03-05 07:49:44 -07:00
Katrina Owen
d5a555fbac Encapsulate dependencies of stats index page
This may be a bit extreme.

It's modeled after the ideal "rails way".

In the controller, we now know the name of a single resource. It
doesn't happen to be backed by a database table, but it does know all
about the task of collecting stats, leaving the controller concerned
with just munging params and rendering stuff.

I called the resource `IndexPage`, to avoid the temptation of trying to
reuse it, which can get pretty messy.

Later, if a better abstraction appears, it should be fairly painless to
alter.
2013-03-02 17:35:19 -07:00
Katrina Owen
615a9e46c9 Encapsulate counts and totals into a class.
Move queries out of the view and into the model layer.
2013-03-02 17:22:15 -07:00
Katrina Owen
6ccb9a81fb Group context-related pieces in a class 2013-03-02 17:21:03 -07:00
Katrina Owen
8b1f0a34a0 Group project-related stats into a class.
Reduce number of instance variables available to the views.
Replace raw SQL with AR-type query.
2013-03-02 17:12:14 -07:00
Katrina Owen
c4433a5ea9 Don't round in ttc.min_sec method
This fixes a bug where it would round 1.8 days up to
2 days, and still display the extra hours in addition.
2013-03-02 16:16:45 -05:00
Katrina Owen
03282638af Move calculation out of view 2013-03-02 16:16:45 -05:00
Katrina Owen
62336f94cd Move time to complete stats into separate class
This separates out the calculations from the queries so we can get
decent tests around them.
2013-03-02 16:16:45 -05:00
Katrina Owen
0ebb98d49f Encapsulate action stats
This gets rid of a bunch of instance variables in the view/controller
layer.
2013-03-02 16:16:45 -05:00
Matt Rogers
004339a2ca Merge pull request #164 from kytrinyx/adjust-font-size
Split up the font size calculation
2013-03-02 05:40:38 -08:00
Katrina Owen
1b7ed32024 Fold two more SQL queries into the query object 2013-03-02 07:54:13 -05:00
Katrina Owen
3f496db4b4 Split up the font size calculation
The font size is a view concern, but the relative size belongs in the
model layer.
2013-03-02 07:14:52 -05:00
Matt Rogers
ae42f9c076 Merge pull request #163 from kytrinyx/stats-project-view
Simplify stats project view
2013-03-01 22:02:39 -08:00