Skip to content

Commit

Permalink
fix hound issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fatboypunk committed Jan 14, 2017
1 parent e606c07 commit 53d2c10
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
5 changes: 5 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,9 @@ def easter?
holiday = Holidays.on(Date.today, :nl)
holiday[0][:name] == "Pasen" if holiday.any?
end

def billable_hours_of(project)
Hour.includes(:category, :user, :project).
where(project: project, billed: false)
end
end
8 changes: 4 additions & 4 deletions app/views/billables/_hours_entries.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
%th= t("billables.table.category")
%th= t("billables.table.hours")
%th= t("billables.table.user")
- Hour.includes(:category, :user, :project).where(project: project, billed: false).each do |hour|
- billable_hours_of(project).each do |hour|
%tr.info-row
%td=billable_entry_checkbox(hour, "hours")
%td=I18n.l (hour.date)
%td=hour.category.name
%td= billable_entry_checkbox(hour, "hours")
%td= I18n.l (hour.date)
%td= hour.category.name
%td.center= hour.value
%td
= link_to hour.user do
Expand Down
4 changes: 2 additions & 2 deletions app/views/billables/_mileages_entries.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
%th= t("billables.table.user")
- project.mileages.where(billed: false).each do |mileage|
%tr.info-row
%td=billable_entry_checkbox(mileage, "mileages")
%td=I18n.l (mileage.date)
%td= billable_entry_checkbox(mileage, "mileages")
%td= I18n.l (mileage.date)
%td
%td.center= mileage.value
%td
Expand Down
9 changes: 6 additions & 3 deletions spec/features/user_visits_billable_entries_overview_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

feature "User manages billables" do
let(:subdomain) { generate(:subdomain) }

Expand All @@ -11,7 +13,7 @@
client = create(:client)
project = create(:project, client: client, billable: true)
project2 = create(:project, client: client, billable: false)
entry = create(:hour, project: project, billed: false)
create(:hour, project: project, billed: false)

visit billables_url(subdomain: subdomain)

Expand All @@ -24,7 +26,7 @@
client = create(:client)
project = create(:project, client: client, billable: true)
project2 = create(:project, client: client, billable: true)
entry = create(:hour, project: project, billed: false)
create(:hour, project: project, billed: false)

visit billables_url(subdomain: subdomain)

Expand Down Expand Up @@ -54,7 +56,8 @@
project = create(:project, client: client, billable: true)
user = create(:user)
entry = create(
:mileage, project: project, user: user, value: 2, billed: false)
:mileage, project: project, user: user, value: 2, billed: false
)

visit billables_url(subdomain: subdomain)

Expand Down

0 comments on commit 53d2c10

Please sign in to comment.