Commit graph

66 commits

Author SHA1 Message Date
Katrina Owen
d6ed7d9722 Add heavy-handed tests against pie chart bug 2013-03-17 19:20:48 -06:00
Katrina Owen
119e536a97 Fix off-by-one error in pie chart data
A pie chart with exactly 10 contexts would show up with 9 contexts +
(other).
2013-03-17 16:20:12 -06: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
6df3534baf Inline last pieces into StatsController#index
We can now skip the before filter that sets instance variables.
2013-03-02 17:27:38 -07:00
Katrina Owen
ac4a483b18 Inline helper method 2013-03-02 17:24:05 -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
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
Katrina Owen
1b7ed32024 Fold two more SQL queries into the query object 2013-03-02 07:54:13 -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
Matt Rogers
3365b7e79f Merge pull request #162 from kytrinyx/projects-stats
Extract duplicate top projects query from stats controller
2013-03-01 21:58:34 -08:00
Katrina Owen
2686a0d3b5 Don't link to null projects
If you have fewer than 10 projects, then empty running projects were
linked to with the path `/projects/-1`.

Copy/pasted the list strategy from the other project sections in the
same partial so the duplication becomes explicit.
2013-03-02 00:19:47 -05:00
Katrina Owen
a23d2eb070 Extract duplicate context query from controller 2013-03-01 23:29:54 -05:00
Katrina Owen
6de4713d38 Extract top projects query object
This removed a bit of duplication from the stats controller.
2013-03-01 23:11:44 -05:00
Matt Rogers
f375c06964 Merge pull request #160 from kytrinyx/tag-counts
Extract duplicated query from stats controller
2013-03-01 18:52:52 -08:00
Katrina Owen
4dff7538ea Extract duplicated query
This includes a bit of a simplification which assumes that there aren't
any orphan taggings for a user.
2013-03-01 21:27:58 -05:00
Katrina Owen
0aa6ea183b Extract chart value object
This simplifies the views (slightly).
2013-03-01 20:38:24 -05:00
Matt Rogers
8b0f3e986a Merge branch 'tag-cloud' of https://github.com/kytrinyx/tracks 2013-03-01 16:49:53 -06:00
Katrina Owen
a13199cdda Add unit test for tag cloud 2013-03-01 16:03:35 -05:00
Katrina Owen
a81f5b76f3 Separate query from cloud
This will make testing easier
2013-03-01 13:14:27 -05:00
Reinier Balt
1e84adc91b get tests running and fix editing context state 2013-03-01 16:22:29 +01:00
Katrina Owen
0f5b402427 Use minimum of tag count for tag cloud
The tag cloud minimum used to start at 0, then repeatedly compared to
the lowest count and chose the smallest, which is bound to be zero in
every case.

Discussed
[here](8c26ea7cb5 (commitcomment-2719199)).
2013-03-01 00:13:41 -05:00
Katrina Owen
b5868d5c70 Use tag cloud objects in view
This allows us to not set the individual instance variables for the tag
cloud attributes.
2013-02-28 22:00:23 -05:00
Katrina Owen
61e04a8258 Extract methods in tag cloud
This gets rid of the compute method, and makes each value that got set
in it its own little method.
2013-02-28 21:53:19 -05:00
Katrina Owen
447178bd7d Collapse duplication in tag cloud model 2013-02-28 21:30:36 -05:00
Katrina Owen
edc793e703 Rename variables
The current user isn't necessarily current when it is in the model
layer.

The exposed attributes on the tag cloud no longer need to contain type
information.
2013-02-28 21:18:00 -05:00
Katrina Owen
8f6d57014a Extract tag cloud class from stats controller 2013-02-28 21:08:48 -05:00
Katrina Owen
ce9db80743 Correct typo in variable name 2013-02-28 20:34:46 -05:00
Reinier Balt
7eccf79ab6 fix regressions and use timecop to fix time in tests. Thanks Dan and Hans! 2013-01-06 16:04:07 +01:00
Matt Rogers
b89062913f remove code duplication 2012-09-08 13:31:22 -05:00
Matt Rogers
f9bd923205 Use a local variable instead of an instance variable
@all_actions_per_context is not used anywhere except for in the
StatsController. It's only used in two functions and it's not used by
anything in the view.

Make it a local variable instead.
2012-09-08 13:12:35 -05:00
Matt Rogers
d9f4226fbe Use a constant for seconds per day
Using an instance variable for this just seems wrong.
2012-09-08 12:55:06 -05:00
Stefan Hacker
e6afd0ac0a Fix max_actions being nil when actions_open_per_week list is empty 2012-09-03 20:43:25 +02:00
Stefan Hacker
7f4065b16b Remove explicit mentioning of application layout where not needed 2012-09-03 20:24:20 +02:00
Stefan Hacker
27adccb6e9 Remove unused layout and clear up naming
* scaffold.css is only used by login -> rename to login.css
* standard.html.erb is the default application layout -> rename to application.html.erb
* scaffold.html.erb is unused -> deleted
2012-09-02 14:20:17 +02:00
Reinier Balt
5e477a4d25 first pass of all tests done 2012-05-18 15:33:47 +02:00
Reinier Balt
63175c115b all non-cucumber tests are passing 2012-04-30 13:56:41 +02:00
Reinier Balt
13b58f3a10 all unit and functional tests are passing 2012-04-30 13:56:40 +02:00
Reinier Balt
fd433d76d8 fix all upgrade warnings from the rails_upgrade plugin 2012-04-30 13:56:38 +02:00
Reinier Balt
5c3293745d merge latest changes for the he locale. Thanks Darian. 2012-04-17 15:33:40 +02:00
Reinier Balt
e935066c18 fix #1181. The project listing now had the small drag handle and all the controls to the left. 2012-01-27 10:55:39 +01:00
Reinier Balt
1bce9a670d implement #1030. 2012-01-21 20:20:24 +01:00
Reinier Balt
bc7bf459db fix small regressions 2012-01-20 23:50:27 +01:00
Reinier Balt
7af2211479 finalize refactoring
finally done, now for ticket 1030 :-)
2012-01-20 23:35:01 +01:00
Reinier Balt
78a2bd7f49 further refactoring of stats controller and views 2012-01-20 23:35:00 +01:00
Reinier Balt
b948cc48b2 further refactoring and more tests 2012-01-20 23:35:00 +01:00
Reinier Balt
2349bee535 further refactorings and tests
one test is failing, will fix that next time
2012-01-20 23:34:59 +01:00
Reinier Balt
80d8d2b67a add tests 2012-01-20 23:34:59 +01:00