Skip to content

Commit

Permalink
Merge pull request #1164 from toladata/TOLA-448-allow-four-decimal-pl…
Browse files Browse the repository at this point in the history
…aces

TOLA-448: Allow four decimal places
  • Loading branch information
ybekdemir authored Feb 21, 2019
2 parents 5514963 + a6f21d2 commit f3ec815
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
51 changes: 51 additions & 0 deletions indicators/migrations/0021_auto_20190220_0254.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-02-20 10:54
from __future__ import unicode_literals

from decimal import Decimal
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('indicators', '0020_auto_20190128_1307'),
]

operations = [
migrations.AlterField(
model_name='collecteddata',
name='achieved',
field=models.DecimalField(decimal_places=4, default=Decimal('0.00'), help_text=b'Actual or total for this record', max_digits=20, verbose_name=b'Achieved'),
),
migrations.AlterField(
model_name='historicalcollecteddata',
name='achieved',
field=models.DecimalField(decimal_places=4, default=Decimal('0.00'), help_text=b'Actual or total for this record', max_digits=20, verbose_name=b'Achieved'),
),
migrations.AlterField(
model_name='historicalindicator',
name='actuals',
field=models.DecimalField(blank=True, decimal_places=4, help_text=b'Sum of collected datas achieved', max_digits=20, null=True),
),
migrations.AlterField(
model_name='historicalindicator',
name='lop_target',
field=models.DecimalField(blank=True, decimal_places=4, default=Decimal('0.00'), help_text=b'Life of Program or Project goal for actual', max_digits=20, verbose_name=b'LOP Target'),
),
migrations.AlterField(
model_name='indicator',
name='actuals',
field=models.DecimalField(blank=True, decimal_places=4, help_text=b'Sum of collected datas achieved', max_digits=20, null=True),
),
migrations.AlterField(
model_name='indicator',
name='lop_target',
field=models.DecimalField(blank=True, decimal_places=4, default=Decimal('0.00'), help_text=b'Life of Program or Project goal for actual', max_digits=20, verbose_name=b'LOP Target'),
),
migrations.AlterField(
model_name='periodictarget',
name='target',
field=models.DecimalField(decimal_places=4, default=Decimal('0.00'), max_digits=20),
),
]
8 changes: 4 additions & 4 deletions indicators/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ class Indicator(models.Model):
unit_of_measure = models.CharField(max_length=135, null=True, blank=True, verbose_name="Unit of Measure", help_text="How will progress be measured")
disaggregation = models.ManyToManyField(DisaggregationType, blank=True, help_text="Predefined units to split total actauls")
baseline = models.CharField(max_length=255, null=True, blank=True, help_text="Initial set of data used for comparison or a control")
lop_target = models.DecimalField("LOP Target", max_digits=20, decimal_places=2, default=Decimal('0.00'), blank=True, help_text="Life of Program or Project goal for actual")
lop_target = models.DecimalField("LOP Target", max_digits=20, decimal_places=4, default=Decimal('0.00'), blank=True, help_text="Life of Program or Project goal for actual")
rationale_for_target = models.TextField(max_length=255, null=True, blank=True, help_text="Reasoning for why the target value was set")
means_of_verification = models.CharField(max_length=255, null=True, blank=True, verbose_name="Means of Verification / Data Source", help_text="Means of Verification / Data Source")
data_collection_method = models.CharField(max_length=255, null=True, blank=True, verbose_name="Data Collection Method", help_text="How was the data collected")
Expand Down Expand Up @@ -401,7 +401,7 @@ class Indicator(models.Model):
calculation_type = models.CharField(blank=True, null=True, max_length=15, choices=CALCULATION_CHOICES)
direction = models.CharField(blank=True, null=True, max_length=15, choices=DIRECTION_CHOICES)
actual_formula = models.CharField(blank=True, null=True, max_length=15)
actuals = models.DecimalField(max_digits=20, decimal_places=2,blank=True, null=True, help_text="Sum of collected datas achieved")
actuals = models.DecimalField(max_digits=20, decimal_places=4,blank=True, null=True, help_text="Sum of collected datas achieved")
total_actual = models.ForeignKey('CollectedData', related_name='indicator_total_actual', on_delete=models.SET_NULL, verbose_name="Total Actual", blank=True, null=True, help_text="The collected data selected to be used in the actual formula")

class Meta:
Expand Down Expand Up @@ -472,7 +472,7 @@ def __unicode__(self):
class PeriodicTarget(models.Model):
indicator = models.ForeignKey(Indicator, null=False, blank=False)
period = models.CharField(max_length=255, null=True, blank=True)
target = models.DecimalField(max_digits=20, decimal_places=2, default=Decimal('0.00'))
target = models.DecimalField(max_digits=20, decimal_places=4, default=Decimal('0.00'))
customsort = models.IntegerField(blank=True, null=True)
create_date = models.DateTimeField(null=True, blank=True)
edit_date = models.DateTimeField(null=True, blank=True)
Expand All @@ -490,7 +490,7 @@ class CollectedData(models.Model):
data_uuid = models.CharField(max_length=255,verbose_name='Data UUID', default=uuid.uuid4, unique=True, blank=True, help_text="")
periodic_target = models.ForeignKey(PeriodicTarget, null=True, blank=True, help_text="Relate this collection to a periodic target")
#targeted = models.DecimalField("Targeted", max_digits=20, decimal_places=2, default=Decimal('0.00'))
achieved = models.DecimalField("Achieved", max_digits=20, decimal_places=2, default=Decimal('0.00'), help_text="Actual or total for this record")
achieved = models.DecimalField("Achieved", max_digits=20, decimal_places=4, default=Decimal('0.00'), help_text="Actual or total for this record")
disaggregation_value = models.ManyToManyField(DisaggregationValue, blank=True, help_text="Values for each disaggregated field")
description = models.TextField("Remarks/comments", blank=True, null=True, help_text="How was this data collected")
indicator = models.ForeignKey(Indicator, help_text="Related indicator for this data")
Expand Down

0 comments on commit f3ec815

Please sign in to comment.