Skip to content

Commit

Permalink
tasotarkistus: renaming of model attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
NC-jsAhonen committed Nov 22, 2024
1 parent 580681b commit 8c907dc
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Generated by Django 4.2.16 on 2024-11-21 13:54

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("leasing", "0082_rent_start_price_index"),
]

operations = [
migrations.RemoveField(
model_name="indexnumberyearly",
name="number",
),
migrations.AddField(
model_name="indexnumberyearly",
name="point_figure",
field=models.DecimalField(
decimal_places=1,
max_digits=8,
null=True,
verbose_name="Index point figure",
),
),
migrations.AlterField(
model_name="rent",
name="start_price_index",
field=models.DecimalField(
decimal_places=1,
max_digits=8,
null=True,
verbose_name="Start price index point figure",
),
),
]
14 changes: 7 additions & 7 deletions leasing/models/rent.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,9 @@ class Rent(TimeStampedSafeDeleteModel):
null=True,
)

# In Finnish: Tasotarkistusindeksi vuokran alkaessa
start_price_index = models.DecimalField(
verbose_name=_("Index number"),
# In Finnish: Tasotarkistusindeksin pisteluku vuokran alkaessa (edellisen vuoden keskiarvo)
start_price_index_point_figure = models.DecimalField(
verbose_name=_("Start price index point figure"),
decimal_places=1,
max_digits=8,
null=True,
Expand Down Expand Up @@ -830,13 +830,13 @@ def is_active_on_period(self, date_range_start, date_range_end):

return False

def set_start_price_index(self):
def set_start_price_index_point_figure(self):
if self.old_dwellings_in_housing_companies_price_index:
start_index_number_yearly = IndexNumberYearly.objects.get(
index=self.old_dwellings_in_housing_companies_price_index,
year=self.start_date.year - 1,
)
self.start_price_index = start_index_number_yearly.number
self.start_price_index_point_figure = start_index_number_yearly.point_figure


class RentDueDate(TimeStampedSafeDeleteModel):
Expand Down Expand Up @@ -1525,8 +1525,8 @@ class IndexNumberYearly(TimeStampedModel):
# should be enough if the numbers are at most in the 100s of thousands.
# Largest index number in the system at the moment is year 1914's index
# with a number around 260 000.
number = models.DecimalField(
verbose_name=_("Index number"),
point_figure = models.DecimalField(
verbose_name=_("Index point figure"),
decimal_places=1,
max_digits=8,
null=True,
Expand Down
4 changes: 2 additions & 2 deletions leasing/serializers/rent.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ class Meta:

class IndexNumberYearlySerializer(serializers.Serializer):
id = serializers.IntegerField(required=False)
number = serializers.DecimalField(max_digits=8, decimal_places=1)
point_figure = serializers.DecimalField(max_digits=8, decimal_places=1)
year = serializers.IntegerField()
region = serializers.CharField(max_length=255, required=False, allow_null=True)
comment = serializers.CharField(required=False, allow_null=True)

class Meta:
model = IndexNumberYearly
fields = ("id", "number", "year", "region", "comment")
fields = ("id", "point_figure", "year", "region", "comment")


class OldDwellingsInHousingCompaniesPriceIndexSerializer(serializers.ModelSerializer):
Expand Down
10 changes: 8 additions & 2 deletions locale/fi/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: MVJ 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-30 14:47+0200\n"
"POT-Creation-Date: 2024-11-21 15:41+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: \n"
"Language: fi\n"
Expand Down Expand Up @@ -2564,6 +2564,12 @@ msgstr ""
msgid "Override receivable type"
msgstr "Korvaava saamislaji"

msgid "Old dwellings in housing companies price index"
msgstr "Vanhojen osakeasuntojen hintaindeksi"

msgid "Start price index point figure"
msgstr "Tasotarkistusindeksin pisteluku vuokran alkaessa"

msgctxt "Model name"
msgid "Rent"
msgstr "Vuokra"
Expand Down Expand Up @@ -2767,7 +2773,7 @@ msgctxt "model name"
msgid "price indexes of old dwellings in housing companies"
msgstr "Vanhojen osakeasuntojen hintaindeksit"

msgid "Index number"
msgid "Index point figure"
msgstr "Indeksipisteluku"

msgid "Comment"
Expand Down

0 comments on commit 8c907dc

Please sign in to comment.