Repository: akvo/akvo-rsr

Issue:
Indicator update - Actual Value Comment (IATI content) (estimate: 8)
Created via Reamaze:

Link: https://rsrsupport.reamaze.com/admin/conversations/deleted-result-comment-still-showing-and-missing-iati-content
Assignee: Geert Soet

Message:
Hi product team,

This morning I had a call with SNV Kenya and we noticed some things in Akvo RSR that seemed to be off:

1) Once you’ve deleted an indicator update, it still shows the comment of that update under actual value comment (see below)

2) In the hortimpact project also documents and images are included in the indicator updates, but the links to these images/docs don’t show up in the IATI report. Can we include these fields (in the same way as the main project picture) in the IATI file?

3) Another issue I found is that indicator descriptions do not show up in the IATI report. This is about project 3992:
First screen shot is of an indicator incl description, second screen shot is the same indicator in the IATI report.

 

Cheers,
Annabelle Poelert
Project Officer

Akvo • 's-Gravenhekje 1A • 1011 TG • Amsterdam (NL)
T +31 20 8200 175 • S Annabelle.akvo • T @annabellepoel I www.akvo.org &lt;http://www.akvo.org/&gt;



Discussion:
Comments from Geert:

1. Confirmed.
2. I guess we could do this at one moment, I know it is for example also mandatory in the DFID IATI guidelines. More documentation here; http://iatistandard.org/202/activity-standard/overview/linked-documents/
3. This is indeed missing and is part of the IATI standard.

@punchagan could you have a look please?

Resolving patch:
diff --git a/akvo/rsr/models/indicator.py b/akvo/rsr/models/indicator.py
--- a/akvo/rsr/models/indicator.py
+++ b/akvo/rsr/models/indicator.py
@@ -760,6 +760,7 @@ def delete(self, *args, **kwargs):
         # In case the status was approved, recalculate the period
         if old_status == self.STATUS_APPROVED_CODE:
             self.period.recalculate_period()
+            self.period.update_actual_comment()
 
     def clean(self):
         """


Test patch:
diff --git a/akvo/rsr/tests/models/test_indicator.py b/akvo/rsr/tests/models/test_indicator.py
--- a/akvo/rsr/tests/models/test_indicator.py
+++ b/akvo/rsr/tests/models/test_indicator.py
@@ -106,3 +106,20 @@ def test_multiple_period_data_updates_actual_comment(self):
         self.assertIn(data_1.text, period.actual_comment)
         # newer update's text appears before older one's
         self.assertLess(period.actual_comment.index(data_2.text), period.actual_comment.index(data_1.text))
+
+    def test_period_data_deletion_updates_actual_comment(self):
+
+        # Given
+        period = self.period
+        user = self.user
+        data = IndicatorPeriodData.objects.create(text='period data comment',
+                                                  period=period,
+                                                  user=user,
+                                                  status=IndicatorPeriodData.STATUS_APPROVED_CODE)
+
+        # When
+        data.delete()
+
+        # Then
+        period = IndicatorPeriod.objects.get(id=period.id)
+        self.assertNotIn(data.text, period.actual_comment)