Noosfero/noosfero

View on GitHub
plugins/social_statistics/db/migrate/20170401104434_create_blazer_default_dashboards_and_queries.rb

Summary

Maintainability
A
1 hr
Test Coverage

Method change has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def change
    # Contents
    contents_dashboard = Blazer::Dashboard.create!(name: "Contents")
    contents_dashboard.queries << Blazer::Query.create!(name: "Contents by type", statement: "SELECT type, COUNT(type) FROM articles GROUP BY type ORDER BY COUNT(type) DESC;", data_source: "main")
    contents_dashboard.queries << Blazer::Query.create!(name: "Contents by category", statement: "SELECT articles.type, COUNT(articles.id) FROM articles INNER JOIN articles_categories ON articles.id = articles_categories.article_id WHERE articles_categories.category_id = {category_id} GROUP BY articles.type ORDER BY COUNT(articles.id) DESC", data_source: "main")

    There are no issues that match your filters.

    Category
    Status