prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  IATI export error when result has no quantitative indicators
  When running the IATI export, a result that has only qualitative indicators is reported as an error.
  
  This seems to be a bug introduced when we started including qualitative indicators in the export, but didn't change the validation to allow for qualitative-only results.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `akvo/iati/checks/fields/results.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 
  3 # Akvo RSR is covered by the GNU Affero General Public License.
  4 # See more details in the license.txt file located at the root folder of the Akvo RSR module.
  5 # For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
  6 
  7 from akvo.rsr.models.result.utils import QUANTITATIVE
  8 
  9 DGIS_VALIDATION_SET_NAME = u"DGIS IATI"
  10 
  11 
  12 def results(project):
  13     """
  14     :param project: Project object
  15     :return: All checks passed boolean, [Check results]
  16     """
  17     checks = []
  18     all_checks_passed = True
  19 
  20     DGIS_PROJECT = project.validations.filter(name=DGIS_VALIDATION_SET_NAME).count() == 1
  21 
  22     for result in project.results.all():
  23         if not result.type:
  24             all_checks_passed = False
  25             checks.append((u'error', u'result (id: %s) has no type specified' % str(result.pk)))
  26 
  27         if not result.title:
  28             all_checks_passed = False
  29             checks.append((u'error', u'result (id: %s) has no title specified' % str(result.pk)))
  30 
  31         if not result.indicators.filter(type=QUANTITATIVE):
  32             all_checks_passed = False
  33             checks.append(
  34                 (u'error', u'result (id: %s) has no quantitative indicator(s)' % str(result.pk))
  35             )
  36 
  37         for indicator in result.indicators.filter(type=QUANTITATIVE):
  38             if not indicator.measure:
  39                 all_checks_passed = False
  40                 checks.append((u'error', u'indicator (id: %s) has no measure specified' %
  41                                str(indicator.pk)))
  42 
  43             if not indicator.title:
  44                 all_checks_passed = False
  45                 checks.append((u'error', u'indicator (id: %s) has no title specified' %
  46                                str(indicator.pk)))
  47 
  48             if not indicator.baseline_value:
  49                 if DGIS_PROJECT:
  50                     all_checks_passed = False
  51                     checks.append((u'warning', u'indicator (id: %s) baseline has no value '
  52                                                u'specified, however the value of "N/A" has been '
  53                                                u'set for the attribute' % str(indicator.pk)))
  54                 elif indicator.baseline_year or indicator.baseline_comment:
  55                     all_checks_passed = False
  56                     checks.append((u'error', u'indicator (id: %s) baseline has no value specified' %
  57                                    str(indicator.pk)))
  58 
  59             if not indicator.baseline_year:
  60                 if DGIS_PROJECT:
  61                     all_checks_passed = False
  62                     checks.append((u'warning', u'indicator (id: %s) baseline has no year '
  63                                                u'specified, however the value of "1" has been '
  64                                                u'set for the attribute' % str(indicator.pk)))
  65                 elif indicator.baseline_value or indicator.baseline_comment:
  66                     all_checks_passed = False
  67                     checks.append((u'error', u'indicator (id: %s) baseline has no year specified' %
  68                                    str(indicator.pk)))
  69 
  70             for reference in indicator.references.all():
  71                 if not reference.reference:
  72                     all_checks_passed = False
  73                     checks.append((u'error', u'indicator reference (id: %s) has no code '
  74                                              u'specified' % str(reference.pk)))
  75 
  76                 if not reference.vocabulary:
  77                     all_checks_passed = False
  78                     checks.append((u'error', u'indicator reference (id: %s) has no vocabulary '
  79                                              u'specified' % str(reference.pk)))
  80 
  81                 if reference.vocabulary == '99' and not reference.vocabulary_uri:
  82                     all_checks_passed = False
  83                     checks.append((u'error', u'indicator reference (id: %s) has vocabulary 99 '
  84                                              u'(reporting organisation) but no vocabulary URI '
  85                                              u'specified' % str(reference.pk)))
  86 
  87             for period in indicator.periods.all():
  88                 if not period.period_start:
  89                     all_checks_passed = False
  90                     checks.append((u'error', u'indicator period (id: %s) has no start date '
  91                                              u'specified' % str(period.pk)))
  92 
  93                 if not period.period_end:
  94                     all_checks_passed = False
  95                     checks.append((u'error', u'indicator period (id: %s) has no end date '
  96                                              u'specified' % str(period.pk)))
  97 
  98                 if period.period_start and period.period_end and \
  99                         period.period_start > period.period_end:
  100                     all_checks_passed = False
  101                     checks.append((u'error', u'indicator period (id: %s) has a start date '
  102                                              u'later than the end date' % str(period.pk)))
  103 
  104                 if not period.target_value:
  105                     if DGIS_PROJECT:
  106                         all_checks_passed = False
  107                         checks.append((u'warning', u'indicator period (id: %s) has no target value '
  108                                                    u'specified. The value "N/A" has been set for '
  109                                                    u'the target value attribute' % str(period.pk)))
  110                     elif (period.target_comment or period.target_locations.all() or
  111                           period.target_dimensions.all()):
  112                         all_checks_passed = False
  113                         checks.append((u'error', u'indicator period (id: %s) has no target value, '
  114                                                  u'but does have a target comment, target '
  115                                                  u'location(s) or target dimension(s)' %
  116                                        str(period.pk)))
  117 
  118                 if not period.actual_value:
  119                     if DGIS_PROJECT:
  120                         all_checks_passed = False
  121                         checks.append((u'warning', u'indicator period (id: %s) has no actual value '
  122                                                    u'specified. The value "N/A" has been set for '
  123                                                    u'the actual value attribute' % str(period.pk)))
  124                     elif (period.actual_comment or period.actual_locations.all() or
  125                           period.actual_dimensions.all()):
  126                         all_checks_passed = False
  127                         checks.append((u'error', u'indicator period (id: %s) has no actual value, '
  128                                                  u'but does have a actual comment, actual '
  129                                                  u'location(s) or actual dimension(s)' %
  130                                        str(period.pk)))
  131 
  132     if project.results.all() and all_checks_passed:
  133         checks.append((u'success', u'has valid result(s)'))
  134 
  135     return all_checks_passed, checks
  136
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/akvo/iati/checks/fields/results.py b/akvo/iati/checks/fields/results.py
  --- a/akvo/iati/checks/fields/results.py
  +++ b/akvo/iati/checks/fields/results.py
  @@ -4,7 +4,7 @@
   # See more details in the license.txt file located at the root folder of the Akvo RSR module.
   # For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
   
  -from akvo.rsr.models.result.utils import QUANTITATIVE
  +from akvo.rsr.models.result.utils import QUANTITATIVE, QUALITATIVE
   
   DGIS_VALIDATION_SET_NAME = u"DGIS IATI"
   
  @@ -28,14 +28,14 @@
               all_checks_passed = False
               checks.append((u'error', u'result (id: %s) has no title specified' % str(result.pk)))
   
  -        if not result.indicators.filter(type=QUANTITATIVE):
  +        if not result.indicators.exists():
               all_checks_passed = False
               checks.append(
  -                (u'error', u'result (id: %s) has no quantitative indicator(s)' % str(result.pk))
  +                (u'error', u'result (id: %s) has no indicator(s)' % str(result.pk))
               )
   
  -        for indicator in result.indicators.filter(type=QUANTITATIVE):
  -            if not indicator.measure:
  +        for indicator in result.indicators.all():
  +            if indicator.type == QUANTITATIVE and not indicator.measure:
                   all_checks_passed = False
                   checks.append((u'error', u'indicator (id: %s) has no measure specified' %
                                  str(indicator.pk)))
  @@ -101,7 +101,7 @@
                       checks.append((u'error', u'indicator period (id: %s) has a start date '
                                                u'later than the end date' % str(period.pk)))
   
  -                if not period.target_value:
  +                if indicator.type == QUANTITATIVE and not period.target_value:
                       if DGIS_PROJECT:
                           all_checks_passed = False
                           checks.append((u'warning', u'indicator period (id: %s) has no target value '
  @@ -115,7 +115,7 @@
                                                    u'location(s) or target dimension(s)' %
                                          str(period.pk)))
   
  -                if not period.actual_value:
  +                if indicator.type == QUANTITATIVE and not period.actual_value:
                       if DGIS_PROJECT:
                           all_checks_passed = False
                           checks.append((u'warning', u'indicator period (id: %s) has no actual value '
  
verification_info: {"golden_diff": "diff --git a/akvo/iati/checks/fields/results.py b/akvo/iati/checks/fields/results.py\n--- a/akvo/iati/checks/fields/results.py\n+++ b/akvo/iati/checks/fields/results.py\n@@ -4,7 +4,7 @@\n # See more details in the license.txt file located at the root folder of the Akvo RSR module.\n # For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n \n-from akvo.rsr.models.result.utils import QUANTITATIVE\n+from akvo.rsr.models.result.utils import QUANTITATIVE, QUALITATIVE\n \n DGIS_VALIDATION_SET_NAME = u\"DGIS IATI\"\n \n@@ -28,14 +28,14 @@\n             all_checks_passed = False\n             checks.append((u'error', u'result (id: %s) has no title specified' % str(result.pk)))\n \n-        if not result.indicators.filter(type=QUANTITATIVE):\n+        if not result.indicators.exists():\n             all_checks_passed = False\n             checks.append(\n-                (u'error', u'result (id: %s) has no quantitative indicator(s)' % str(result.pk))\n+                (u'error', u'result (id: %s) has no indicator(s)' % str(result.pk))\n             )\n \n-        for indicator in result.indicators.filter(type=QUANTITATIVE):\n-            if not indicator.measure:\n+        for indicator in result.indicators.all():\n+            if indicator.type == QUANTITATIVE and not indicator.measure:\n                 all_checks_passed = False\n                 checks.append((u'error', u'indicator (id: %s) has no measure specified' %\n                                str(indicator.pk)))\n@@ -101,7 +101,7 @@\n                     checks.append((u'error', u'indicator period (id: %s) has a start date '\n                                              u'later than the end date' % str(period.pk)))\n \n-                if not period.target_value:\n+                if indicator.type == QUANTITATIVE and not period.target_value:\n                     if DGIS_PROJECT:\n                         all_checks_passed = False\n                         checks.append((u'warning', u'indicator period (id: %s) has no target value '\n@@ -115,7 +115,7 @@\n                                                  u'location(s) or target dimension(s)' %\n                                        str(period.pk)))\n \n-                if not period.actual_value:\n+                if indicator.type == QUANTITATIVE and not period.actual_value:\n                     if DGIS_PROJECT:\n                         all_checks_passed = False\n                         checks.append((u'warning', u'indicator period (id: %s) has no actual value '\n", "issue": "IATI export error when result has no quantitative indicators\nWhen running the IATI export, a result that has only qualitative indicators is reported as an error.\r\n\r\nThis seems to be a bug introduced when we started including qualitative indicators in the export, but didn't change the validation to allow for qualitative-only results.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Akvo RSR is covered by the GNU Affero General Public License.\n# See more details in the license.txt file located at the root folder of the Akvo RSR module.\n# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n\nfrom akvo.rsr.models.result.utils import QUANTITATIVE\n\nDGIS_VALIDATION_SET_NAME = u\"DGIS IATI\"\n\n\ndef results(project):\n    \"\"\"\n    :param project: Project object\n    :return: All checks passed boolean, [Check results]\n    \"\"\"\n    checks = []\n    all_checks_passed = True\n\n    DGIS_PROJECT = project.validations.filter(name=DGIS_VALIDATION_SET_NAME).count() == 1\n\n    for result in project.results.all():\n        if not result.type:\n            all_checks_passed = False\n            checks.append((u'error', u'result (id: %s) has no type specified' % str(result.pk)))\n\n        if not result.title:\n            all_checks_passed = False\n            checks.append((u'error', u'result (id: %s) has no title specified' % str(result.pk)))\n\n        if not result.indicators.filter(type=QUANTITATIVE):\n            all_checks_passed = False\n            checks.append(\n                (u'error', u'result (id: %s) has no quantitative indicator(s)' % str(result.pk))\n            )\n\n        for indicator in result.indicators.filter(type=QUANTITATIVE):\n            if not indicator.measure:\n                all_checks_passed = False\n                checks.append((u'error', u'indicator (id: %s) has no measure specified' %\n                               str(indicator.pk)))\n\n            if not indicator.title:\n                all_checks_passed = False\n                checks.append((u'error', u'indicator (id: %s) has no title specified' %\n                               str(indicator.pk)))\n\n            if not indicator.baseline_value:\n                if DGIS_PROJECT:\n                    all_checks_passed = False\n                    checks.append((u'warning', u'indicator (id: %s) baseline has no value '\n                                               u'specified, however the value of \"N/A\" has been '\n                                               u'set for the attribute' % str(indicator.pk)))\n                elif indicator.baseline_year or indicator.baseline_comment:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator (id: %s) baseline has no value specified' %\n                                   str(indicator.pk)))\n\n            if not indicator.baseline_year:\n                if DGIS_PROJECT:\n                    all_checks_passed = False\n                    checks.append((u'warning', u'indicator (id: %s) baseline has no year '\n                                               u'specified, however the value of \"1\" has been '\n                                               u'set for the attribute' % str(indicator.pk)))\n                elif indicator.baseline_value or indicator.baseline_comment:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator (id: %s) baseline has no year specified' %\n                                   str(indicator.pk)))\n\n            for reference in indicator.references.all():\n                if not reference.reference:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator reference (id: %s) has no code '\n                                             u'specified' % str(reference.pk)))\n\n                if not reference.vocabulary:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator reference (id: %s) has no vocabulary '\n                                             u'specified' % str(reference.pk)))\n\n                if reference.vocabulary == '99' and not reference.vocabulary_uri:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator reference (id: %s) has vocabulary 99 '\n                                             u'(reporting organisation) but no vocabulary URI '\n                                             u'specified' % str(reference.pk)))\n\n            for period in indicator.periods.all():\n                if not period.period_start:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator period (id: %s) has no start date '\n                                             u'specified' % str(period.pk)))\n\n                if not period.period_end:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator period (id: %s) has no end date '\n                                             u'specified' % str(period.pk)))\n\n                if period.period_start and period.period_end and \\\n                        period.period_start > period.period_end:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator period (id: %s) has a start date '\n                                             u'later than the end date' % str(period.pk)))\n\n                if not period.target_value:\n                    if DGIS_PROJECT:\n                        all_checks_passed = False\n                        checks.append((u'warning', u'indicator period (id: %s) has no target value '\n                                                   u'specified. The value \"N/A\" has been set for '\n                                                   u'the target value attribute' % str(period.pk)))\n                    elif (period.target_comment or period.target_locations.all() or\n                          period.target_dimensions.all()):\n                        all_checks_passed = False\n                        checks.append((u'error', u'indicator period (id: %s) has no target value, '\n                                                 u'but does have a target comment, target '\n                                                 u'location(s) or target dimension(s)' %\n                                       str(period.pk)))\n\n                if not period.actual_value:\n                    if DGIS_PROJECT:\n                        all_checks_passed = False\n                        checks.append((u'warning', u'indicator period (id: %s) has no actual value '\n                                                   u'specified. The value \"N/A\" has been set for '\n                                                   u'the actual value attribute' % str(period.pk)))\n                    elif (period.actual_comment or period.actual_locations.all() or\n                          period.actual_dimensions.all()):\n                        all_checks_passed = False\n                        checks.append((u'error', u'indicator period (id: %s) has no actual value, '\n                                                 u'but does have a actual comment, actual '\n                                                 u'location(s) or actual dimension(s)' %\n                                       str(period.pk)))\n\n    if project.results.all() and all_checks_passed:\n        checks.append((u'success', u'has valid result(s)'))\n\n    return all_checks_passed, checks\n", "path": "akvo/iati/checks/fields/results.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Akvo RSR is covered by the GNU Affero General Public License.\n# See more details in the license.txt file located at the root folder of the Akvo RSR module.\n# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.\n\nfrom akvo.rsr.models.result.utils import QUANTITATIVE, QUALITATIVE\n\nDGIS_VALIDATION_SET_NAME = u\"DGIS IATI\"\n\n\ndef results(project):\n    \"\"\"\n    :param project: Project object\n    :return: All checks passed boolean, [Check results]\n    \"\"\"\n    checks = []\n    all_checks_passed = True\n\n    DGIS_PROJECT = project.validations.filter(name=DGIS_VALIDATION_SET_NAME).count() == 1\n\n    for result in project.results.all():\n        if not result.type:\n            all_checks_passed = False\n            checks.append((u'error', u'result (id: %s) has no type specified' % str(result.pk)))\n\n        if not result.title:\n            all_checks_passed = False\n            checks.append((u'error', u'result (id: %s) has no title specified' % str(result.pk)))\n\n        if not result.indicators.exists():\n            all_checks_passed = False\n            checks.append(\n                (u'error', u'result (id: %s) has no indicator(s)' % str(result.pk))\n            )\n\n        for indicator in result.indicators.all():\n            if indicator.type == QUANTITATIVE and not indicator.measure:\n                all_checks_passed = False\n                checks.append((u'error', u'indicator (id: %s) has no measure specified' %\n                               str(indicator.pk)))\n\n            if not indicator.title:\n                all_checks_passed = False\n                checks.append((u'error', u'indicator (id: %s) has no title specified' %\n                               str(indicator.pk)))\n\n            if not indicator.baseline_value:\n                if DGIS_PROJECT:\n                    all_checks_passed = False\n                    checks.append((u'warning', u'indicator (id: %s) baseline has no value '\n                                               u'specified, however the value of \"N/A\" has been '\n                                               u'set for the attribute' % str(indicator.pk)))\n                elif indicator.baseline_year or indicator.baseline_comment:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator (id: %s) baseline has no value specified' %\n                                   str(indicator.pk)))\n\n            if not indicator.baseline_year:\n                if DGIS_PROJECT:\n                    all_checks_passed = False\n                    checks.append((u'warning', u'indicator (id: %s) baseline has no year '\n                                               u'specified, however the value of \"1\" has been '\n                                               u'set for the attribute' % str(indicator.pk)))\n                elif indicator.baseline_value or indicator.baseline_comment:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator (id: %s) baseline has no year specified' %\n                                   str(indicator.pk)))\n\n            for reference in indicator.references.all():\n                if not reference.reference:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator reference (id: %s) has no code '\n                                             u'specified' % str(reference.pk)))\n\n                if not reference.vocabulary:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator reference (id: %s) has no vocabulary '\n                                             u'specified' % str(reference.pk)))\n\n                if reference.vocabulary == '99' and not reference.vocabulary_uri:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator reference (id: %s) has vocabulary 99 '\n                                             u'(reporting organisation) but no vocabulary URI '\n                                             u'specified' % str(reference.pk)))\n\n            for period in indicator.periods.all():\n                if not period.period_start:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator period (id: %s) has no start date '\n                                             u'specified' % str(period.pk)))\n\n                if not period.period_end:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator period (id: %s) has no end date '\n                                             u'specified' % str(period.pk)))\n\n                if period.period_start and period.period_end and \\\n                        period.period_start > period.period_end:\n                    all_checks_passed = False\n                    checks.append((u'error', u'indicator period (id: %s) has a start date '\n                                             u'later than the end date' % str(period.pk)))\n\n                if indicator.type == QUANTITATIVE and not period.target_value:\n                    if DGIS_PROJECT:\n                        all_checks_passed = False\n                        checks.append((u'warning', u'indicator period (id: %s) has no target value '\n                                                   u'specified. The value \"N/A\" has been set for '\n                                                   u'the target value attribute' % str(period.pk)))\n                    elif (period.target_comment or period.target_locations.all() or\n                          period.target_dimensions.all()):\n                        all_checks_passed = False\n                        checks.append((u'error', u'indicator period (id: %s) has no target value, '\n                                                 u'but does have a target comment, target '\n                                                 u'location(s) or target dimension(s)' %\n                                       str(period.pk)))\n\n                if indicator.type == QUANTITATIVE and not period.actual_value:\n                    if DGIS_PROJECT:\n                        all_checks_passed = False\n                        checks.append((u'warning', u'indicator period (id: %s) has no actual value '\n                                                   u'specified. The value \"N/A\" has been set for '\n                                                   u'the actual value attribute' % str(period.pk)))\n                    elif (period.actual_comment or period.actual_locations.all() or\n                          period.actual_dimensions.all()):\n                        all_checks_passed = False\n                        checks.append((u'error', u'indicator period (id: %s) has no actual value, '\n                                                 u'but does have a actual comment, actual '\n                                                 u'location(s) or actual dimension(s)' %\n                                       str(period.pk)))\n\n    if project.results.all() and all_checks_passed:\n        checks.append((u'success', u'has valid result(s)'))\n\n    return all_checks_passed, checks\n", "path": "akvo/iati/checks/fields/results.py"}]}