Skip to content

Commit 42b67df

Browse files
authored
Merge pull request #301 from American-Institutes-for-Research/HEA-986/Times-per-year-rounding-errors
Make OtherCashIncome.times_per_year float as times_per_month may be f…
2 parents abdfe91 + b68e73d commit 42b67df

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from django.db import migrations, models
2+
3+
4+
class Migration(migrations.Migration):
5+
6+
dependencies = [
7+
("baseline", "0038_other_livestock_production"),
8+
]
9+
10+
operations = [
11+
migrations.AlterField(
12+
model_name="othercashincome",
13+
name="times_per_year",
14+
field=models.FloatField(
15+
blank=True,
16+
help_text="Number of times in a year that the income is received",
17+
null=True,
18+
verbose_name="Times per year",
19+
),
20+
),
21+
]

apps/baseline/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2758,7 +2758,8 @@ class OtherCashIncome(LivelihoodActivity):
27582758
verbose_name=_("Months per year"),
27592759
help_text=_("Number of months in a year that the labor is performed"),
27602760
)
2761-
times_per_year = models.PositiveSmallIntegerField(
2761+
# This is a float field because times_per_month may be fractional (e.g. 4.3/month * 12 months = 51.6/year).
2762+
times_per_year = models.FloatField(
27622763
blank=True,
27632764
null=True,
27642765
verbose_name=_("Times per year"),

0 commit comments

Comments
 (0)