{"id":13835624,"url":"https://github.com/vinsol/solidus_admin_insights","last_synced_at":"2025-07-10T10:30:42.784Z","repository":{"id":59155970,"uuid":"88826623","full_name":"vinsol/solidus_admin_insights","owner":"vinsol","description":"Dashboard for querying and viewing you solidus store's metrics","archived":false,"fork":false,"pushed_at":"2017-09-21T04:20:42.000Z","size":357,"stargazers_count":3,"open_issues_count":5,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-31T14:47:53.714Z","etag":null,"topics":["solidus","solidus-extensions"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vinsol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-20T05:59:36.000Z","updated_at":"2018-08-20T17:39:48.000Z","dependencies_parsed_at":"2022-09-13T18:13:19.843Z","dependency_job_id":null,"html_url":"https://github.com/vinsol/solidus_admin_insights","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinsol%2Fsolidus_admin_insights","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinsol%2Fsolidus_admin_insights/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinsol%2Fsolidus_admin_insights/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinsol%2Fsolidus_admin_insights/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinsol","download_url":"https://codeload.github.com/vinsol/solidus_admin_insights/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225632929,"owners_count":17499889,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["solidus","solidus-extensions"],"created_at":"2024-08-04T14:01:06.689Z","updated_at":"2024-11-20T21:31:12.232Z","avatar_url":"https://github.com/vinsol.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"SolidusAdminInsights\n==============\n\nDashboard for querying and viewing you solidus store's metrics. Use SolidusEventTracker to capture the metrics\n\nInstallation\n------------\n\nAdd solidus_admin_insights to your Gemfile:\n\n```ruby\ngem 'solidus_admin_insights'\n```\n\nBundle your dependencies and run the installation generator:\n\n```shell\nbundle\nbundle exec rails g solidus_admin_insights:install\nbundle exec rails g solidus_events_tracker:install\n```\n\nAdding new reports\n-------------------\n\nCreate a class that inherits from `Spree::Report` and define a `report_query` method. If the report is to be paginated. it should define also define a method called `paginated` and set it to return `true` alongwith defining `paginated_report_query` and `record_count_query`. the `_query` methods should return objects that respond to `to_sql` which returns sql string for reporting query.\n\nAll reports need to define the following constants:\n1.  `SORTABLE_ATTRIBUTES`: Other attributes based on which reports can be sorted.\n2.  `DEFAULT_SORTABLE_ATTRIBUTE`: The attribute which is used by default to sort the report results.\n3.  `HEADERS`: The static header fields for report. Note time based fields are automatically added. Any field not declared here but available in observation will be ignored while displaying the report.\n4.  `SEARCH_ATTRIBUTES`: A hash containing the attributes and their name on frontend based on which report result can be filtered.\n\nAdditionally they need to define two nested classes. `Result` and `Result::Observation`.\n\n`Result` class can inherit from `Spree::Report::Result` if it is a basic report or from `Spree::Report::TimedResult` if the result can be time scaled(i.e. changing reporting period changes the scale of report).\n\nSimilarly Observation class needs to inherit either from `Spree::Report::Observation` or `Spree::Report::TimedObservation`. It defines a macro call `observation_fields` which can be passed an array or hash with default values of fields which form one report item. Create a method of same name in Observation class for virtual fields which are not returned by queries. ie. average or for formatting db results.\n\n`TimedResult` has 2 lifecycle methods which can be overriden for customizing the report output.\n1. `build_empty_observations`: Generates empty observations which are later filled with datapoints returned by report query.\n2. `populate_observations`: Fill the empty observations with data returned via query.\n\n`TimedObservation` defines a describes? method which can be overriden to change where the query results gets copied to.\n\nYou can add charts to reports by calling `charts` with a list of classes representing the chart. Each chart implementing class gets the results in it's initializer and need to implement to_h method returning the json representation of chart.\n\nFinally, register the report in initializer `solidus_admin_insights.rb` in its appropriate category or make a new category to make it available in admin dashboard.\n\nTesting\n-------\n\nFirst bundle your dependencies, then run `rake`. `rake` will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using `rake test_app`.\n\n```shell\nbundle\nbundle exec rake\n```\n\nWhen testing your applications integration with this extension you may use it's factories.\nSimply add this require statement to your spec_helper:\n\n```ruby\nrequire 'solidus_admin_insights/factories'\n```\n\nCredits\n-------\n\n[![vinsol.com: Ruby on Rails, iOS and Android developers](http://vinsol.com/vin_logo.png \"Ruby on Rails, iOS and Android developers\")](http://vinsol.com)\n\nCopyright (c) 2017 [vinsol.com](http://vinsol.com \"Ruby on Rails, iOS and Android developers\"), released under the New MIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinsol%2Fsolidus_admin_insights","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinsol%2Fsolidus_admin_insights","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinsol%2Fsolidus_admin_insights/lists"}