Skip to content

Commit

Permalink
fix corner case of subcontactors with cost but no selling rate
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalfox committed Apr 24, 2024
1 parent eac1f6b commit 422fcc6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions staffing/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def objectiveMargin(self, startDate=None, endDate=None):
n_days = timesheet_data.get(month, 0)
if consultant.subcontractor:
# Compute objective margin on sold rate after removing standard subcontractor budget margin
if consultant_rates[consultant][0] and consultant_rates[consultant][1]:
if consultant_rates[consultant][0] is not None and consultant_rates[consultant][1]:
result[consultant] += n_days * (consultant_rates[consultant][0] * (1 - get_parameter("SUBCONTRACTOR_BUDGET_MARGIN")/100) - consultant_rates[consultant][1])
else:
# Compute objective margin on rate objective for this period
Expand All @@ -400,7 +400,7 @@ def objectiveMargin(self, startDate=None, endDate=None):
n_days = staffing_data.get(month, 0) - timesheet_data.get(month, 0) # substract timesheet data from staffing to avoid twice counting
if consultant.subcontractor:
# Compute objective margin on sold rate
if consultant_rates[consultant][0] and consultant_rates[consultant][1]:
if consultant_rates[consultant][0] is not None and consultant_rates[consultant][1]:
result[consultant] += n_days * (consultant_rates[consultant][0] * (1 - get_parameter("SUBCONTRACTOR_BUDGET_MARGIN")/100) - consultant_rates[consultant][1])
else:
# Compute objective margin on rate objective for this period
Expand Down

0 comments on commit 422fcc6

Please sign in to comment.