Skip to content

Commit

Permalink
Add default 0 for additional work in unconfirmed prices calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
indigane committed Nov 21, 2024
1 parent 5ec68ea commit 3fc09f5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/hitas/services/indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,10 @@ def subquery_apartment_first_sale_acquisition_price_index_adjusted(
first_sale_acquisition_price,
output_field=HitasModelDecimalField(),
)
additional_work = Coalesce(F("additional_work_during_construction"), 0, output_field=HitasModelDecimalField())

return Round(
(acquisition_price + F("additional_work_during_construction") + interest)
(acquisition_price + additional_work + interest)
* depreciation
* current_value
/ NullIf(original_value, 0, output_field=HitasModelDecimalField()), # prevent zero division errors
Expand Down

0 comments on commit 3fc09f5

Please sign in to comment.