Last active
December 11, 2015 22:58
-
-
Save nateberkopec/4672785 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mokha | |
class HomeController < Mokha::BaseController | |
def index | |
@view = Mokha::HomePresenter.new | |
@view.user = User.includes(:ratings).find(current_user) | |
@view.user.track('Opened Mokha') | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mokha | |
class HomePresenter | |
attr_accessor :user | |
def has_extra_issues? | |
(@user.main_subscription.issues.received - released_issues).any? | |
end | |
def next_ship_date | |
user.main_subscription.issues.next_ship_date | |
end | |
def title | |
"Craft Coffee: Journey" | |
end | |
private | |
def released_issues #hack for now | |
Issue.includes(:features => :roaster).where{ | |
(ship_date >= Date.parse('19-11-2012')) & (ship_date <= Date.today) | |
} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment