Skip to content

Commit

Permalink
fix: fix int type
Browse files Browse the repository at this point in the history
  • Loading branch information
kgarbacinski committed Aug 29, 2024
1 parent 0aaf45e commit a3277d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend/app/engine/projects/rewards/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ def get_total_allocations_below_threshold(
self, allocations: List[AllocationItem], no_projects: int
) -> AllocationsBelowThreshold:
return AllocationsBelowThreshold(
0, sum(map(lambda allocation: allocation.amount, allocations))
0, sum(map(lambda allocation: int(allocation.amount), allocations))
)
7 changes: 4 additions & 3 deletions backend/app/engine/projects/rewards/threshold/preliminary.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ def calculate_threshold(self, payload: ProjectThresholdPayload) -> int:
def get_total_allocations_below_threshold(
self, allocations: List[AllocationItem], no_projects: int
) -> AllocationsBelowThreshold:
allocations_sum = sum(map(lambda x: x.amount, allocations))
allocations_sum = sum(map(lambda x: int(x.amount), allocations))
threshold = self.calculate_threshold(
ProjectThresholdPayload(allocations_sum, no_projects)
)

allocations_below_threshold = 0
for allocation in allocations:
if allocation.amount < threshold:
allocations_below_threshold += allocation.amount
amount = int(allocation.amount)
if amount < threshold:
allocations_below_threshold += amount

return AllocationsBelowThreshold(allocations_below_threshold, allocations_sum)

0 comments on commit a3277d4

Please sign in to comment.