{"action":"created","comment":{"url":"https://api.github.com/repos/solidusio/solidus/pulls/comments/67984935","id":67984935,"diff_hunk":"@@ -0,0 +1,68 @@\n+module Spree\n+  module Reports\n+    # Variants that are out of stock\n+    class OutOfStockVariants < Base\n+      def initialize(params)\n+        @page = params[:page]\n+        now = Time.zone.now\n+        today = Time.zone.today\n+        start_date = params[:start_date] || today.at_beginning_of_month.to_s.tr(\"-\", \"/\")\n+        end_date = params[:end_date] || today.at_end_of_month.to_s.tr(\"-\", \"/\")\n+        @start_time = !start_date.blank? ? parse_date_param(start_date) : (now - 2.days)\n+        @end_time = !end_date.blank? ? parse_date_param(end_date) : now\n+      end\n+\n+      def content(format = :html)","path":"backend/app/models/spree/reports/out_of_stock_variants.rb","position":15,"original_position":15,"commit_id":"647f696a87253044e1cc1d5d97a1795777663828","original_commit_id":"647f696a87253044e1cc1d5d97a1795777663828","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Unused method argument - `format`. If it's necessary, use `_` or `_format` as an argument name to indicate that it won't be used. You can also write as `content(*)` if you want the method to accept any arguments but don't care about them.","created_at":"2016-06-22T02:07:49Z","updated_at":"2016-06-22T02:07:49Z","html_url":"https://github.com/solidusio/solidus/pull/1250#discussion_r67984935","pull_request_url":"https://api.github.com/repos/solidusio/solidus/pulls/1250","_links":{"self":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/comments/67984935"},"html":{"href":"https://github.com/solidusio/solidus/pull/1250#discussion_r67984935"},"pull_request":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/1250"}}},"pull_request":{"url":"https://api.github.com/repos/solidusio/solidus/pulls/1250","id":73853221,"html_url":"https://github.com/solidusio/solidus/pull/1250","diff_url":"https://github.com/solidusio/solidus/pull/1250.diff","patch_url":"https://github.com/solidusio/solidus/pull/1250.patch","issue_url":"https://api.github.com/repos/solidusio/solidus/issues/1250","number":1250,"state":"open","locked":false,"title":"Extract reports from controller","user":{"login":"isaacfreeman","id":342659,"avatar_url":"https://avatars.githubusercontent.com/u/342659?v=3","gravatar_id":"","url":"https://api.github.com/users/isaacfreeman","html_url":"https://github.com/isaacfreeman","followers_url":"https://api.github.com/users/isaacfreeman/followers","following_url":"https://api.github.com/users/isaacfreeman/following{/other_user}","gists_url":"https://api.github.com/users/isaacfreeman/gists{/gist_id}","starred_url":"https://api.github.com/users/isaacfreeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isaacfreeman/subscriptions","organizations_url":"https://api.github.com/users/isaacfreeman/orgs","repos_url":"https://api.github.com/users/isaacfreeman/repos","events_url":"https://api.github.com/users/isaacfreeman/events{/privacy}","received_events_url":"https://api.github.com/users/isaacfreeman/received_events","type":"User","site_admin":false},"body":"When we have more than a handful of reports for a Solidus site, we typically end up with a long and messy decorator for the reports controller. This PR introduces a structure that allows us to extract the logic for each report into its own class, and declare which reports we want to be active in an initializer.\r\n\r\nI appreciate this isn't ready to merge yet, but I'm opening the pull request for comment on whether this is a desirable approach. It's worked well for me with clients, but I don't know how universal my experience is. What do you think?\r\n\r\nNotes:\r\n- Specs currently aren't passing\r\n- I've aimed to maintain backwards compatibility with existing decorators that use `Spree::ReportsController.add_available_report!`\r\n- There's some metaprogramming to generate an action in the controller for each generated report. This could perhaps be made less magical by simply using a show method that receives the desired report as a param, but this would break backwards compatibility.\r\n- I've added a second report showing variants that are out of stock. I'm not assuming that this specific report needs to also be merged into Solidus, and I'm open to removing it or moving it to a separate PR even if there's consensus on the general approach. I'll leave it in for now to illustrate how additional reports can be added.\r\n- The seed data currently doesn't have any out-of-stock variants, so you'll see no rows in the table until you make one. In the console for the sandbox app, run `Spree::StockItem.first.set_count_on_hand(0)`.\r\n- The out-of-stock variants report uses a `table_report` view that's intended to be generally useful for any report that generates a table.","created_at":"2016-06-15T05:18:11Z","updated_at":"2016-06-22T02:07:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3cbcca94cc22106fd4226324ef1685f52687f61","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/solidusio/solidus/pulls/1250/commits","review_comments_url":"https://api.github.com/repos/solidusio/solidus/pulls/1250/comments","review_comment_url":"https://api.github.com/repos/solidusio/solidus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/solidusio/solidus/issues/1250/comments","statuses_url":"https://api.github.com/repos/solidusio/solidus/statuses/647f696a87253044e1cc1d5d97a1795777663828","head":{"label":"isaacfreeman:refactor/extract_reports_from_controller","ref":"refactor/extract_reports_from_controller","sha":"647f696a87253044e1cc1d5d97a1795777663828","user":{"login":"isaacfreeman","id":342659,"avatar_url":"https://avatars.githubusercontent.com/u/342659?v=3","gravatar_id":"","url":"https://api.github.com/users/isaacfreeman","html_url":"https://github.com/isaacfreeman","followers_url":"https://api.github.com/users/isaacfreeman/followers","following_url":"https://api.github.com/users/isaacfreeman/following{/other_user}","gists_url":"https://api.github.com/users/isaacfreeman/gists{/gist_id}","starred_url":"https://api.github.com/users/isaacfreeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isaacfreeman/subscriptions","organizations_url":"https://api.github.com/users/isaacfreeman/orgs","repos_url":"https://api.github.com/users/isaacfreeman/repos","events_url":"https://api.github.com/users/isaacfreeman/events{/privacy}","received_events_url":"https://api.github.com/users/isaacfreeman/received_events","type":"User","site_admin":false},"repo":{"id":59264398,"name":"solidus","full_name":"isaacfreeman/solidus","owner":{"login":"isaacfreeman","id":342659,"avatar_url":"https://avatars.githubusercontent.com/u/342659?v=3","gravatar_id":"","url":"https://api.github.com/users/isaacfreeman","html_url":"https://github.com/isaacfreeman","followers_url":"https://api.github.com/users/isaacfreeman/followers","following_url":"https://api.github.com/users/isaacfreeman/following{/other_user}","gists_url":"https://api.github.com/users/isaacfreeman/gists{/gist_id}","starred_url":"https://api.github.com/users/isaacfreeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isaacfreeman/subscriptions","organizations_url":"https://api.github.com/users/isaacfreeman/orgs","repos_url":"https://api.github.com/users/isaacfreeman/repos","events_url":"https://api.github.com/users/isaacfreeman/events{/privacy}","received_events_url":"https://api.github.com/users/isaacfreeman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/isaacfreeman/solidus","description":"Solidus, Rails eCommerce System","fork":true,"url":"https://api.github.com/repos/isaacfreeman/solidus","forks_url":"https://api.github.com/repos/isaacfreeman/solidus/forks","keys_url":"https://api.github.com/repos/isaacfreeman/solidus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/isaacfreeman/solidus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/isaacfreeman/solidus/teams","hooks_url":"https://api.github.com/repos/isaacfreeman/solidus/hooks","issue_events_url":"https://api.github.com/repos/isaacfreeman/solidus/issues/events{/number}","events_url":"https://api.github.com/repos/isaacfreeman/solidus/events","assignees_url":"https://api.github.com/repos/isaacfreeman/solidus/assignees{/user}","branches_url":"https://api.github.com/repos/isaacfreeman/solidus/branches{/branch}","tags_url":"https://api.github.com/repos/isaacfreeman/solidus/tags","blobs_url":"https://api.github.com/repos/isaacfreeman/solidus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/isaacfreeman/solidus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/isaacfreeman/solidus/git/refs{/sha}","trees_url":"https://api.github.com/repos/isaacfreeman/solidus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/isaacfreeman/solidus/statuses/{sha}","languages_url":"https://api.github.com/repos/isaacfreeman/solidus/languages","stargazers_url":"https://api.github.com/repos/isaacfreeman/solidus/stargazers","contributors_url":"https://api.github.com/repos/isaacfreeman/solidus/contributors","subscribers_url":"https://api.github.com/repos/isaacfreeman/solidus/subscribers","subscription_url":"https://api.github.com/repos/isaacfreeman/solidus/subscription","commits_url":"https://api.github.com/repos/isaacfreeman/solidus/commits{/sha}","git_commits_url":"https://api.github.com/repos/isaacfreeman/solidus/git/commits{/sha}","comments_url":"https://api.github.com/repos/isaacfreeman/solidus/comments{/number}","issue_comment_url":"https://api.github.com/repos/isaacfreeman/solidus/issues/comments{/number}","contents_url":"https://api.github.com/repos/isaacfreeman/solidus/contents/{+path}","compare_url":"https://api.github.com/repos/isaacfreeman/solidus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/isaacfreeman/solidus/merges","archive_url":"https://api.github.com/repos/isaacfreeman/solidus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/isaacfreeman/solidus/downloads","issues_url":"https://api.github.com/repos/isaacfreeman/solidus/issues{/number}","pulls_url":"https://api.github.com/repos/isaacfreeman/solidus/pulls{/number}","milestones_url":"https://api.github.com/repos/isaacfreeman/solidus/milestones{/number}","notifications_url":"https://api.github.com/repos/isaacfreeman/solidus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/isaacfreeman/solidus/labels{/name}","releases_url":"https://api.github.com/repos/isaacfreeman/solidus/releases{/id}","deployments_url":"https://api.github.com/repos/isaacfreeman/solidus/deployments","created_at":"2016-05-20T04:17:00Z","updated_at":"2016-05-20T04:17:04Z","pushed_at":"2016-06-22T02:07:45Z","git_url":"git://github.com/isaacfreeman/solidus.git","ssh_url":"git@github.com:isaacfreeman/solidus.git","clone_url":"https://github.com/isaacfreeman/solidus.git","svn_url":"https://github.com/isaacfreeman/solidus","homepage":"http://solidus.io/","size":63302,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"solidusio:master","ref":"master","sha":"542c9f6c7b8e41de64aed392181bd5a15dd79a36","user":{"login":"solidusio","id":11045486,"avatar_url":"https://avatars.githubusercontent.com/u/11045486?v=3","gravatar_id":"","url":"https://api.github.com/users/solidusio","html_url":"https://github.com/solidusio","followers_url":"https://api.github.com/users/solidusio/followers","following_url":"https://api.github.com/users/solidusio/following{/other_user}","gists_url":"https://api.github.com/users/solidusio/gists{/gist_id}","starred_url":"https://api.github.com/users/solidusio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solidusio/subscriptions","organizations_url":"https://api.github.com/users/solidusio/orgs","repos_url":"https://api.github.com/users/solidusio/repos","events_url":"https://api.github.com/users/solidusio/events{/privacy}","received_events_url":"https://api.github.com/users/solidusio/received_events","type":"Organization","site_admin":false},"repo":{"id":30985840,"name":"solidus","full_name":"solidusio/solidus","owner":{"login":"solidusio","id":11045486,"avatar_url":"https://avatars.githubusercontent.com/u/11045486?v=3","gravatar_id":"","url":"https://api.github.com/users/solidusio","html_url":"https://github.com/solidusio","followers_url":"https://api.github.com/users/solidusio/followers","following_url":"https://api.github.com/users/solidusio/following{/other_user}","gists_url":"https://api.github.com/users/solidusio/gists{/gist_id}","starred_url":"https://api.github.com/users/solidusio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solidusio/subscriptions","organizations_url":"https://api.github.com/users/solidusio/orgs","repos_url":"https://api.github.com/users/solidusio/repos","events_url":"https://api.github.com/users/solidusio/events{/privacy}","received_events_url":"https://api.github.com/users/solidusio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/solidusio/solidus","description":"Solidus, Rails eCommerce System","fork":false,"url":"https://api.github.com/repos/solidusio/solidus","forks_url":"https://api.github.com/repos/solidusio/solidus/forks","keys_url":"https://api.github.com/repos/solidusio/solidus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/solidusio/solidus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/solidusio/solidus/teams","hooks_url":"https://api.github.com/repos/solidusio/solidus/hooks","issue_events_url":"https://api.github.com/repos/solidusio/solidus/issues/events{/number}","events_url":"https://api.github.com/repos/solidusio/solidus/events","assignees_url":"https://api.github.com/repos/solidusio/solidus/assignees{/user}","branches_url":"https://api.github.com/repos/solidusio/solidus/branches{/branch}","tags_url":"https://api.github.com/repos/solidusio/solidus/tags","blobs_url":"https://api.github.com/repos/solidusio/solidus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/solidusio/solidus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/solidusio/solidus/git/refs{/sha}","trees_url":"https://api.github.com/repos/solidusio/solidus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/solidusio/solidus/statuses/{sha}","languages_url":"https://api.github.com/repos/solidusio/solidus/languages","stargazers_url":"https://api.github.com/repos/solidusio/solidus/stargazers","contributors_url":"https://api.github.com/repos/solidusio/solidus/contributors","subscribers_url":"https://api.github.com/repos/solidusio/solidus/subscribers","subscription_url":"https://api.github.com/repos/solidusio/solidus/subscription","commits_url":"https://api.github.com/repos/solidusio/solidus/commits{/sha}","git_commits_url":"https://api.github.com/repos/solidusio/solidus/git/commits{/sha}","comments_url":"https://api.github.com/repos/solidusio/solidus/comments{/number}","issue_comment_url":"https://api.github.com/repos/solidusio/solidus/issues/comments{/number}","contents_url":"https://api.github.com/repos/solidusio/solidus/contents/{+path}","compare_url":"https://api.github.com/repos/solidusio/solidus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/solidusio/solidus/merges","archive_url":"https://api.github.com/repos/solidusio/solidus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/solidusio/solidus/downloads","issues_url":"https://api.github.com/repos/solidusio/solidus/issues{/number}","pulls_url":"https://api.github.com/repos/solidusio/solidus/pulls{/number}","milestones_url":"https://api.github.com/repos/solidusio/solidus/milestones{/number}","notifications_url":"https://api.github.com/repos/solidusio/solidus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/solidusio/solidus/labels{/name}","releases_url":"https://api.github.com/repos/solidusio/solidus/releases{/id}","deployments_url":"https://api.github.com/repos/solidusio/solidus/deployments","created_at":"2015-02-18T20:41:58Z","updated_at":"2016-06-22T00:37:36Z","pushed_at":"2016-06-22T02:07:46Z","git_url":"git://github.com/solidusio/solidus.git","ssh_url":"git@github.com:solidusio/solidus.git","clone_url":"https://github.com/solidusio/solidus.git","svn_url":"https://github.com/solidusio/solidus","homepage":"https://solidus.io/","size":69635,"stargazers_count":977,"watchers_count":977,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":283,"mirror_url":null,"open_issues_count":136,"forks":283,"open_issues":136,"watchers":977,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/1250"},"html":{"href":"https://github.com/solidusio/solidus/pull/1250"},"issue":{"href":"https://api.github.com/repos/solidusio/solidus/issues/1250"},"comments":{"href":"https://api.github.com/repos/solidusio/solidus/issues/1250/comments"},"review_comments":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/1250/comments"},"review_comment":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/solidusio/solidus/pulls/1250/commits"},"statuses":{"href":"https://api.github.com/repos/solidusio/solidus/statuses/647f696a87253044e1cc1d5d97a1795777663828"}}}}
{"actor":{"display_login":"houndci-bot"}}