Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add admin budget stats #3499

Merged
merged 15 commits into from
May 16, 2019
Merged

Add admin budget stats #3499

merged 15 commits into from
May 16, 2019

Conversation

javierm
Copy link
Member

@javierm javierm commented May 16, 2019

@javierm javierm self-assigned this May 16, 2019

ballot_1 = create(:budget_ballot, budget: @budget, user: user_1)
ballot_2 = create(:budget_ballot, budget: @budget, user: user_2)
ballot_3 = create(:budget_ballot, budget: @budget, user: user_3)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/UselessAssignment: Useless assignment to variable - ballot_3. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)


all_city_investment = create(:budget_investment, heading: all_city)
carabanchel_investment = create(:budget_investment, heading: carabanchel)
carabanchel_investment = create(:budget_investment, heading: carabanchel)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/UselessAssignment: Useless assignment to variable - carabanchel_investment. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)

barajas = create(:budget_heading, group: group_districts)

all_city_investment = create(:budget_investment, heading: all_city)
carabanchel_investment = create(:budget_investment, heading: carabanchel)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/UselessAssignment: Useless assignment to variable - carabanchel_investment. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)

carabanchel = create(:budget_heading, group: group_districts)
barajas = create(:budget_heading, group: group_districts)

all_city_investment = create(:budget_investment, heading: all_city)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/UselessAssignment: Useless assignment to variable - all_city_investment. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)

scenario "Number of users that have supported an investment project" do
user1 = create(:user, :level_two)
user2 = create(:user, :level_two)
user3 = create(:user, :level_two)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/UselessAssignment: Useless assignment to variable - user3. Did you mean user1? (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)


@vote_count_by_heading = @budget.lines.group(:heading_id).count.collect {|k,v| [Budget::Heading.find(k).name, v]}.sort

@user_count_by_district = User.where.not(balloted_heading_id: nil).group(:balloted_heading_id).count.collect {|k,v| [Budget::Heading.find(k).name, v]}.sort

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [159/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)


@vote_count = @budget.lines.count

@vote_count_by_heading = @budget.lines.group(:heading_id).count.collect {|k,v| [Budget::Heading.find(k).name, v]}.sort

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [122/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)

app/controllers/admin/stats_controller.rb Outdated Show resolved Hide resolved
@@ -29,6 +27,9 @@ def show
ds.add "Budget Investments", Budget::Investment.group_by_day(:created_at).count
end

if params[:user_supported_budgets].present?
ds.add "User supported budgets", Vote.where(votable_type: "Budget::Investment").group_by_day(:updated_at).count

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [117/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)

ds.add event.titleize, Ahoy::Event.where(name: event).group_by_day(:time).count
end
if params[:event].present?
ds.add params[:event].titleize, Ahoy::Event.where(name: params[:event]).group_by_day(:time).count

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [103/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)

@javierm javierm changed the title [WIP] Improve admin stats [WIP] Add admin budget stats May 16, 2019
@javierm javierm changed the title [WIP] Add admin budget stats Add admin budget stats May 16, 2019
@javierm javierm merged commit 668b6cf into master May 16, 2019
@javierm javierm deleted the backport-admin_stats branch May 16, 2019 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants