feat(time_entries): add time_entries app's basic structure and endpoints
This commit is contained in:
22
apps/time_entries/services/rates.py
Normal file
22
apps/time_entries/services/rates.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from apps.projects.models import ProjectRate, ProjectUserRate
|
||||
|
||||
|
||||
def resolve_rate(user, project):
|
||||
user_rate = ProjectUserRate.objects.filter(
|
||||
user=user,
|
||||
project=project,
|
||||
is_active=True,
|
||||
).order_by("-effective_from").first()
|
||||
|
||||
if user_rate:
|
||||
return user_rate.hourly_rate, user_rate.currency
|
||||
|
||||
project_rate = ProjectRate.objects.filter(
|
||||
project=project,
|
||||
is_active=True,
|
||||
).order_by("-effective_from").first()
|
||||
|
||||
if project_rate:
|
||||
return project_rate.hourly_rate, project_rate.currency
|
||||
|
||||
return None, "USD"
|
||||
Reference in New Issue
Block a user