Repository: akvo/akvo-rsr

Issue:
Improve IATI export
## Test plan

Before starting with testing, make sure to perform two one-time actions:
- The `iati_export` cron job is running (done on Test and UAT)
  - See running cron jobs by running: `manage.py crontab show`;
- The `perform_iati_checks` management command has been run (done on Test and UAT).

---

GIVEN the 'My IATI' section in MyRSR
WHEN connected to multiple organisations (or as superuser)
THEN an organisation selection screen should be shown

WHEN connected to one organisation
THEN this organisation should be automatically selected

GIVEN the 'My IATI' section in MyRSR
WHEN an organisation has been selected
THEN the overview of all IATI exports should be shown
AND for each export the status, number of projects, created by, created at and IATI version should be shown
AND the latest IATI export should be shown in a green row
AND a pending or in progress IATI export should be shown in a yellow row
AND a cancelled or export without an IATI file should be shown in a red row

GIVEN the 'My IATI' section in MyRSR
WHEN an organisation has been selected
THEN it should be possible to select whether the latest IATI file is shown on the organisation page

GIVEN that is has been set that the latest IATI file is shown on the organisation page
THEN it should be shown on the organisation page as well
ELSE the IATI file should not be shown

GIVEN that the 'Add new IATI export' button is clicked
THEN the user should be redirected to the project selection overview

GIVEN the project selection overview
WHEN looking at the projects overview
THEN all projects where the selected organisation is reporting organisation should be shown

GIVEN the project selection overview
WHEN applying a filter
THEN the project selection should change
AND the indication of the number of projects selected should indicate the number of selected projects

GIVEN the project selection overview
WHEN projects are selected AND the 'create new IATI export' button is clicked
THEN the user should be redirected to the IATI exports overview
AND the top IATI export should be the new IATI export (with 'Pending' status)

GIVEN the IATI export overview
WHEN an export is pending or in progress
THEN the overview should be refreshed every 10 seconds
AND when an export is in progress, the number of processed projects should be shown
## Issue description

Currently, an IATI export with more than 70 projects will give a DB timeout. However, we need to be able to export an IATI file with any amount of projects. Similar to the IATI import, we can use a cron job for this.
- [x] Move IATI export to a cron job implementation
- [x] Update the 'My IATI' tab in MyRSR



Discussion:
"Add a new IATI export" button sends GET request to ".../myrsr/iati/**&**new=true", should be ".../myrsr/iati/**?**new=true"

Issue only occurs when user belongs to only one organization (thus ?org=X is missing)

In project selection overview, "Create a new IATI export" button only works for superuser. For org admins, the server raises a 403 Forbidden error and hangs.

Clicking the 'Add new IATI export' button now gives a 403.

Based on @JosjeS's feedback, we should remove some of the filters:
- All status filters
- The 'all' and 'public' filters

In addition, filters should work independently from each other.


Resolving patch:
diff --git a/akvo/rsr/feeds.py b/akvo/rsr/feeds.py
--- a/akvo/rsr/feeds.py
+++ b/akvo/rsr/feeds.py
@@ -227,7 +227,7 @@ def description(self, obj):
 
     def items(self, obj):
         # Limited to 25 items to prevent gateway timeouts.
-        return obj.published_projects().all_updates()[:25]
+        return obj.all_updates()[:25]
 
     def item_title(self, item):
         return _(


Test patch: