Skip to content

Commit

Permalink
Support dual timesheet views for consultants
Browse files Browse the repository at this point in the history
Added functionality to display current and previous month timesheets side by side for consultants. This involved updating query parameters to accommodate two datasets and adjusting the component state management for handling both months. Additionally, removed specific style constraints in AllocationCalendar for a more flexible layout.
ElemarJR committed Dec 1, 2024
1 parent d24b75c commit f7de75e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions backend/src/models/analytics/revenue_tracking.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import calendar
import globals

from datetime import date, datetime, timedelta
@@ -255,6 +256,33 @@ def process_project(date_of_interest: date, case: Case, project, timesheet_df: p
"fee": fee,
"fixed": True
}
elif case.pre_contracted_value:
fee = case.pre_contracted_value / 100

should_do_pro_rata = (
case.start_of_contract
and case.start_of_contract.year == date_of_interest.year
and case.start_of_contract.month == date_of_interest.month
)

if should_do_pro_rata:
fee = fee * (date_of_interest.day / calendar.monthrange(date_of_interest.year, date_of_interest.month)[1])

should_do_pro_rata = (
case.end_of_contract
and case.end_of_contract.year == date_of_interest.year
and case.end_of_contract.month == date_of_interest.month
)

if should_do_pro_rata:
fee = fee * (calendar.monthrange(date_of_interest.year, date_of_interest.month)[1] / date_of_interest.day)

return {
"kind": project.kind,
"name": project.name,
"fee": project.billing.fee / 100,
"fixed": True
}
else:
project_df = timesheet_df[timesheet_df["ProjectId"] == project.id]
if len(project_df) == 0:

0 comments on commit f7de75e

Please sign in to comment.