Skip to content

Commit

Permalink
Merge pull request #2356 from unicef/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
domdinicola authored Jun 6, 2019
2 parents e10d523 + 2b27784 commit ffa9f33
Show file tree
Hide file tree
Showing 144 changed files with 1,371 additions and 2,211 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- run:
name: Run Tests
command: |
tox -e d21,report
tox -e d22,report
- save_cache:
key: deps2-{{ .Branch }}--{{ checksum "Pipfile.lock" }}-{{ checksum ".circleci/config.yml" }}
paths:
Expand Down
24 changes: 12 additions & 12 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,37 @@ carto = "==1.4"
celery = "==4.3"
dj-database-url = "==0.5"
dj-static = "==0.0.6"
Django = "==2.1.8"
Django = "==2.2.1"
django-appconf = "==1.0.3"
django_celery_beat = "==1.4"
django-celery-email = "==2.0.1"
django_celery_results = "==1.0.4"
django-contrib-comments = "==1.9.1"
django-cors-headers = "==2.5"
django-cors-headers = "==2.5.3"
django-debug-toolbar = "==1.11"
django-extensions = "==2.1.6"
django-easy-pdf = "==0.1.1"
django-filter = "==2.1"
django-fsm = "==2.6"
django-fsm = "==2.6.1"
django-import-export = "==1.2"
django-js-asset = "==1.2.2"
django-leaflet = "==0.24"
django-logentry-admin = "==1.0.4"
django-model-utils = "==3.1.2"
django-mptt = "==0.9.1"
django-ordered-model = "==3.1.1"
django-post_office = "==3.1.0"
django-redis-cache = "==2.0"
django-rest-swagger = "==2.2"
django-storages = "==1.6.6"
django-tenants = "==2.1"
django-tenants = "==2.2.2"
django-timezone-field = "==3.0"
django-waffle = "==0.15.1"
django-waffle = "==0.16"
djangorestframework-csv = "==2.1.0"
djangorestframework-gis = "==0.14"
djangorestframework-jwt = "==1.11.0"
djangorestframework-recursive = "==0.1.2"
djangorestframework-xml = "==1.4"
djangorestframework = "==3.9.2"
djangorestframework = "==3.9.3"
drf-nested-routers = "==0.91"
drf-querystringfilter = "==1.0.0"
etools-validator = "==0.3.2"
Expand All @@ -64,20 +63,21 @@ gunicorn = "==19.9"
newrelic = "==2.94.0.79"
Pillow = "==5.4.1"
psycopg2-binary = "==2.8.2"
sentry-sdk = "==0.7.10"
redis = "==3.2"
sentry-sdk = "==0.7.14"
redis = "==3.2.1"
requests = "==2.21"
social-auth-app-django = "==2.1.0"
social-auth-core = {extras = ["azuread"],version = "==1.7.0"}
social-auth-app-django = "==3.1"
social-auth-core = {extras = ["azuread"],version = "==3.1"}
tenant-schemas-celery = "==0.2.1"
unicef_attachments = "==0.5.1"
unicef-djangolib = "==0.5.2"
unicef-locations = "==1.5"
unicef-locations = "==1.7"
unicef_notification = "==0.2.1"
unicef_restlib = "==0.4"
unicef_snapshot = "==0.2.3"
unicef-rest-export = "==0.5.3"
xhtml2pdf = "==0.2.3"
unicef-vision = "*"

[requires]
python_version = "3.6.4"
256 changes: 139 additions & 117 deletions Pipfile.lock

Large diffs are not rendered by default.

56 changes: 51 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,24 @@ AGILE METHODOLOGY
-----------------

The development of eTools takes on a methodology known as Agile. This methodology takes into account shot, iterative software development cycles that incorporates user feedback.
Development strategy is similar to git flow approach.
New feature and bugfix are merged into development when PR have been approved and CI passes.
Once development is completed, changes are moved to staging for QA testing.
Adjustments and fixes should go direct to staging while new features should go in development.
Once QA is completed staging branch is merged to master.

MODULES
-------

eTools development follows a phased and modular approach to software development, with releases based on an agreed set of prioritized modules and features – new modules and features are released on a quarterly basis.
eTools development follows a phased and modular approach to software development, with releases based on an agreed set of prioritized modules and features – new modules and features are released on a monthly basis.

These are  modules planned for the eTools platform:
These are modules currently in production for the eTools:
* Partnership Management Portal (PMP)
* Dashboard (DASH)
* Trip Management (T2F)
* Financial Assurance Module (FAM)
* Third Party Monitoring (TPM)
* Action Point Dashboard (APD)


DEVELOPMENT ROADMAP
Expand All @@ -50,9 +61,7 @@ Links
+--------------------+----------------+--------------+--------------------+
| Source Code |https://github.com/unicef/etools |
+--------------------+----------------+-----------------------------------+
| Issue tracker |https://github.com/unicef/etools/issues |
+--------------------+----------------+-----------------------------------+
| Planning |https://app.clubhouse.io/unicefetools/dashboard |
| Issue tracker |https://app.clubhouse.io/unicefetools/stories |
+--------------------+----------------+-----------------------------------+


Expand All @@ -63,3 +72,40 @@ Links
.. |dev-cov| image:: https://circleci.com/gh/unicef/etools/tree/develop.svg?style=svg
:target: https://circleci.com/gh/unicef/etools/tree/develop



Testing
-------------------

+---------------------------------+--------------------------------------------------------+
| tox | runs flake and checks there are not missing migrations |
+---------------------------------+--------------------------------------------------------+
| tox -r | in case you want to reuse the virtualenv |
+---------------------------------+--------------------------------------------------------+
| python manage.py test <package> | run test related to a specific package |
+---------------------------------+--------------------------------------------------------+


Environments
--------------------
+----------------+---------------------------+-------------------------------------------------+
| Development | etools-dev.unicef.org | - Development environment for developers |
| | | - Potentially instable |
+----------------+---------------------------+-------------------------------------------------+
| Staging | etools-staging.unicef.org | - Staging environment for QA testing |
| | | - Release candidate |
+----------------+---------------------------+-------------------------------------------------+
| Demo | etools-demo.unicef.org | - Demo environment |
| | | - Same version of production |
| | | - Used for demo, workshops and troubleshooting |
+----------------+---------------------------+-------------------------------------------------+
| Test | etools-test.unicef.org | - Coming soon |
+----------------+---------------------------+-------------------------------------------------+
| Production | etools.unicef.org | - Production environment |
+----------------+---------------------------+-------------------------------------------------+


Troubleshoot
--------------------
* Exception are logged in Sentry: https://sentry.io/unicef-jk/
* Each container in Rancher allows to access local logs
2 changes: 1 addition & 1 deletion runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ python -W ignore manage.py makemigrations --dry-run --check
# Check code style unless running under tox, in which case tox runs flake8 separately
if [[ $RUNNING_UNDER_TOX != 1 ]] ; then
time flake8 src/
# time isort -rc src/ --check-only
time isort -rc src/ --check-only
fi

# Run unittests and coverage report
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Framework :: Django',
'Framework :: Django :: 2.1',
],
)
2 changes: 1 addition & 1 deletion src/etools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION = __version__ = '6.10'
VERSION = __version__ = '7.0'
NAME = 'eTools'
5 changes: 3 additions & 2 deletions src/etools/applications/action_points/export/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
class ActionPointCSVRenderer(ListSeperatorCSVRenderMixin, FriendlyCSVRenderer):

header = [
'ref', 'cp_output', 'partner', 'office', 'section', 'category', 'assigned_to', 'due_date',
'ref', 'ref_link', 'cp_output', 'partner', 'office', 'section', 'category', 'assigned_to', 'due_date',
'status', 'high_priority', 'description', 'intervention', 'pd_ssfa', 'location', 'related_module',
'assigned_by', 'date_of_completion', 'related_ref', 'related_object_str', 'related_object_url', 'action_taken'
'assigned_by', 'date_of_completion', 'related_ref', 'related_object_str', 'related_object_url', 'action_taken',
]
labels = {
'ref': _('Ref. #'),
'ref_link': _('Link'),
'cp_output': _('CP Output'),
'partner': _('Partner'),
'office': _('Office'),
Expand Down
4 changes: 4 additions & 0 deletions src/etools/applications/action_points/export/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
class ActionPointExportSerializer(serializers.Serializer):

ref = serializers.CharField(source='reference_number', read_only=True)
ref_link = serializers.SerializerMethodField()
cp_output = serializers.CharField(allow_null=True)
partner = serializers.CharField(source='partner.name', allow_null=True)
office = serializers.CharField(source='office.name', allow_null=True)
Expand All @@ -28,3 +29,6 @@ class ActionPointExportSerializer(serializers.Serializer):
def get_action_taken(self, obj):
return ";\n\n".join(["{} ({}): {}".format(c.user if c.user else '-', c.submit_date.strftime(
"%d %b %Y"), c.comment) for c in obj.comments.all()])

def get_ref_link(self, obj):
return obj.get_object_url()
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.1 on 2019-05-23 11:46

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('action_points', '0008_auto_20180731_1050'),
]

operations = [
migrations.AlterField(
model_name='actionpoint',
name='travel_activity',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='t2f.TravelActivity', verbose_name='Travel Activity'),
),
]
2 changes: 1 addition & 1 deletion src/etools/applications/action_points/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class ActionPoint(TimeStampedModel):
tpm_activity = models.ForeignKey('tpm.TPMActivity', verbose_name=_('TPM Activity'), blank=True, null=True,
related_name='action_points', on_delete=models.CASCADE,
)
travel_activity = models.ForeignKey('t2f.TravelActivity', verbose_name=_('Travel'), blank=True, null=True,
travel_activity = models.ForeignKey('t2f.TravelActivity', verbose_name=_('Travel Activity'), blank=True, null=True,
on_delete=models.CASCADE,
)

Expand Down
96 changes: 0 additions & 96 deletions src/etools/applications/action_points/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django_comments.models import Comment
from rest_framework import serializers
from unicef_locations.serializers import LocationLightSerializer
from unicef_rest_export.serializers import ExportSerializer
from unicef_restlib.fields import SeparatedReadWriteField
from unicef_restlib.serializers import UserContextSerializerMixin, WritableNestedSerializerMixin
from unicef_snapshot.models import Activity
Expand Down Expand Up @@ -181,98 +180,3 @@ def validate_category(self, value):
if value and value.module != self.instance.related_module:
raise serializers.ValidationError(_('Category doesn\'t belong to selected module.'))
return value


class ActionPointListExportSerializer(ExportSerializer):
engagement = serializers.SerializerMethodField()
tpm_activity = serializers.SerializerMethodField()
travel_activity = serializers.SerializerMethodField()

class Meta(ActionPointListSerializer.Meta):
pass

def get_engagement(self, obj):
return obj.engagement

def get_tpm_activity(self, obj):
return obj.tpm_activity

def get_travel_activity(self, obj):
return obj.travel_activity

def get_headers(self, data):
headers = []
for field in data[0].keys():
headers.append(str(self.get_header_label(field)))
return headers

def transform_cp_output(self, data):
if data is None:
return data
return data.get("result_name", "")

def transform_location(self, data):
if data is None:
return data
return data.get("name", "")

def transform_office(self, data):
if data is None:
return data
return data.get("name", "")

def transform_section(self, data):
if data is None:
return data
return data.get("name", "")

def transform_author(self, data):
return "{} {}".format(
data.get("first_name", ""),
data.get("last_name", "")
)

def transform_assigned_by(self, data):
return "{} {}".format(
data.get("first_name", ""),
data.get("last_name", "")
)

def transform_assigned_to(self, data):
return "{} {}".format(
data.get("first_name", ""),
data.get("last_name", "")
)

def transform_partner(self, data):
if data is None:
return data
return data.get("name", "")

def transform_intervention(self, data):
if data is None:
return data
return data.get("number", "")

def transform_category(self, data):
if data is None:
return data
return data.get("module", "")

def transform_dataset(self, dataset):
transform_fields = [
'category',
'assigned_to',
'author',
'assigned_by',
'section',
'office',
'cp_output',
'partner',
'intervention',
'location',
]
for field in transform_fields:
func = getattr(self, "transform_{}".format(field))
dataset.add_formatter(str(self.get_header_label(field)), func)
return dataset
2 changes: 1 addition & 1 deletion src/etools/applications/action_points/tests/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from etools.libraries.djangolib.models import GroupWrapper


class ActionPointsTestCaseMixin(object):
class ActionPointsTestCaseMixin:
def setUp(self):
super().setUp()

Expand Down
Loading

0 comments on commit ffa9f33

Please sign in to comment.