Skip to content

Commit

Permalink
Develop (#1805)
Browse files Browse the repository at this point in the history
* admin tweaks

* Update common module ref (#1799)

* [ch28888] Indicator calculation methods are not displayed sometimes

* added piwik to frontend_cluster

* update common submodule ref

* submodule ref

* Update common module ref (#1801)

* [ch28888] Indicator calculation methods are not displayed sometimes

* added piwik to frontend_cluster

* update common submodule ref

* updated common module ref

* submodule ref

* [ch28580] XLS progress-report export incorrect values on Total column

* submodule ref

* Bump django from 3.2.6 to 3.2.15 in /django_api

Bumps [django](https://github.com/django/django) from 3.2.6 to 3.2.15.
- [Release notes](https://github.com/django/django/releases)
- [Commits](django/django@3.2.6...3.2.15)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* [ch31022]Fix-Dropdown color theme not aligned with the rest of the app (#1810)

* Submodule ref

* submodule ref

* Dropdown color sync

* submodule ref

* [ch31044]Show toast on enter data error (#1811)

* submodule ref

* [ch30238] /manifest.json Get request returns status 404 (#1796)

* [ch28888] Indicator calculation methods are not displayed sometimes

* added piwik to frontend_cluster

* [ch30238] /manifest.json Get request returns status 404

Co-authored-by: Adriana Trif <[email protected]>

* [ch31020] Filter by location from reporting-on-results fix; tests

* [ch31042]Anchor tag style update (#1812)

* A tag style update

* build

* A tag style update

* submodule ref

* [ch31031] [Improvement] Add improvement to differentiate between Reports that are VIEW only and EDITABLE [Progress Reports] (#1814)

* [ch31031] [Improvement] Add improvement to differentiate between Reports that are VIEW only and EDITABLE [Progress Reports]

* fix merge

* Line endings

Co-authored-by: Mercea Emil <[email protected]>
Co-authored-by: Trif Adriana <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Domenico <[email protected]>
Co-authored-by: Ema Ciupe <[email protected]>
Co-authored-by: Dan <[email protected]>
Co-authored-by: Ema Ciupe <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Robert Avram <[email protected]>
Co-authored-by: merceaemil <[email protected]>
Co-authored-by: Mercea Emil <[email protected]>
  • Loading branch information
9 people authored Aug 22, 2022
1 parent c602f7b commit 188ca00
Show file tree
Hide file tree
Showing 15 changed files with 469 additions and 299 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ workflows:
- master
- staging
- develop
- fix-icon-color-update

- links-style
- build_and_deploy_fe_cluster:
filters:
branches:
Expand Down
2 changes: 1 addition & 1 deletion django_api/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Babel = "<=2.9.1"
boto3 = "<=1.18.24"
carto = "<=1.11.3"
cryptography = "<3.4" # issue with image
django = "<=3.2.6"
django = "<3.2.16"
django-admin-extra-urls = "<=3.5.1"
django-celery-beat = "<=2.2.1"
django-celery-email = "<=3.0"
Expand Down
639 changes: 352 additions & 287 deletions django_api/Pipfile.lock

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions django_api/etools_prp/apps/indicator/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ class IndicatorReportAdmin(admin.ModelAdmin):

class IndicatorLocationDataAdmin(admin.ModelAdmin):
list_display = ('indicator_report', 'location', 'num_disaggregation',
'level_reported')
list_filter = ('num_disaggregation', 'level_reported',)
'level_reported', 'indicator_type')
list_filter = ('num_disaggregation', 'level_reported', 'indicator_report__reportable__blueprint__display_type')
search_fields = ('indicator_report__title', 'location__name')
raw_id_fields = ['location', 'indicator_report']

def indicator_type(self, obj):
return obj.indicator_report.reportable.blueprint.display_type


class DisaggregationAdmin(admin.ModelAdmin):
list_display = ('name', 'response_plan', 'active', 'external_id')
Expand Down
10 changes: 8 additions & 2 deletions django_api/etools_prp/apps/unicef/exports/annex_c_excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from etools_prp.apps.indicator.constants import ValueType
from etools_prp.apps.indicator.models import Disaggregation, IndicatorBlueprint
from etools_prp.apps.indicator.utilities import convert_string_number_to_float
from etools_prp.apps.indicator.utilities import convert_string_number_to_float, format_total_value_to_string
from etools_prp.apps.unicef.exports.utilities import PARTNER_PORTAL_DATE_FORMAT_EXCEL
from etools_prp.apps.unicef.models import ProgressReport

Expand Down Expand Up @@ -385,9 +385,15 @@ def write_indicator_reports_to_current_sheet(self, current_row, indicator_report

for disaggregation, total_value in location_data.disaggregation.items():
combination_column = disaggregation_column_map.get(disaggregation)

is_percentage = indicator_report.reportable.blueprint.unit == indicator_report.reportable.blueprint.PERCENTAGE
total = format_total_value_to_string(
total_value,
is_percentage=is_percentage,
percentage_display_type='ratio' if indicator_report.reportable.blueprint.display_type == 'ratio' else None)
if combination_column:
self.current_sheet.cell(
row=current_row, column=combination_column, value=total_value.get(ValueType.VALUE)
row=current_row, column=combination_column, value=total
)
else:
logger.exception('Location data {} contains unknown disaggregation: {}'.format(
Expand Down
2 changes: 1 addition & 1 deletion django_api/etools_prp/apps/unicef/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def get_indicator_reports(self, obj):
queryset = obj.indicator_reports.all()
if self.llo_id and self.llo_id is not None:
queryset = queryset.filter(reportable__object_id=self.llo_id)
if self.location_id and self.llo_id is not None:
if self.location_id and self.location_id is not None:
queryset = queryset.filter(reportable__locations__id=self.location_id)

if self.show_incomplete_only in [1, "1", "true", "True", True]:
Expand Down
57 changes: 57 additions & 0 deletions django_api/etools_prp/apps/unicef/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,63 @@ def test_detail_api_filter_incomplete(self):
ir_qs.count(),
)

def test_detail_api_filter_location(self):
progress_report = self.pd.progress_reports.first()
ir_qs = IndicatorReport.objects.filter(
progress_report=progress_report,
)
url = reverse(
'progress-reports-details',
args=[self.workspace.pk, progress_report.pk],
)
response = self.client.get(url, format='json')
self.assertEquals(response.status_code, status.HTTP_200_OK)
self.assertEquals(
len(response.data['indicator_reports']),
ir_qs.count(),
)
new_loc = factories.LocationFactory()
llo_reportable_2 = factories.QuantityReportableToLowerLevelOutputFactory(
content_object=self.llo,
blueprint=factories.QuantityTypeIndicatorBlueprintFactory(
unit=IndicatorBlueprint.NUMBER,
calculation_formula_across_locations=IndicatorBlueprint.SUM,
)
)
factories.LocationWithReportableLocationGoalFactory(
location=new_loc,
reportable=llo_reportable_2,
)
factories.ProgressReportIndicatorReportFactory(
progress_report=progress_report,
reportable=llo_reportable_2,
report_status=INDICATOR_REPORT_STATUS.submitted,
overall_status=OVERALL_STATUS.met,
)

# test an indicator report exists for given location
ir_qs = ir_qs.filter(reportable__locations__id=new_loc.pk)
self.assertEquals(ir_qs.count(), 1)
url_loc_filter = url + f'?location={new_loc.pk}'
response = self.client.get(url_loc_filter, format='json')
self.assertEquals(response.status_code, status.HTTP_200_OK)
self.assertEquals(
len(response.data['indicator_reports']),
ir_qs.count(),
)

# test no indicator reports exist for a unused location
unused_loc = factories.LocationFactory()
ir_qs = ir_qs.filter(reportable__locations__id=unused_loc.pk)
self.assertEquals(ir_qs.count(), 0)
url_loc_filter = url + f'?location={unused_loc.pk}'
response = self.client.get(url_loc_filter, format='json')
self.assertEquals(response.status_code, status.HTTP_200_OK)
self.assertEquals(
len(response.data['indicator_reports']),
0,
)

@patch("etools_prp.apps.utils.emails.EmailTemplate.objects.update_or_create")
@patch.object(Notification, "full_clean", return_value=None)
@patch.object(Notification, "send_notification", return_value=None)
Expand Down
2 changes: 1 addition & 1 deletion frontend_cluster/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<link rel="icon" href="images/favicon.ico">

<!-- See https://goo.gl/OOhYW5 -->
<link rel="manifest" href="/manifest.json">
<link rel="manifest" href="/cluster/manifest.json">

<!-- See https://goo.gl/qRE0vM -->
<meta name="theme-color" content="#2E3AA1">
Expand Down
6 changes: 6 additions & 0 deletions frontend_cluster/src_ts/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ export const locales = {
edit_partner: 'Edit Partner',
changes_saved: 'Changes saved.',
an_error_occurred: 'An error occurred, please try again later.',
error_verify_entered_data: 'An error occured, please verify entered data.',
file_uploaded: 'File uploaded.',
file_deleted: 'File deleted.',
request_ocha_timed_out: 'Request to OCHA timed out. Please try again.',
Expand Down Expand Up @@ -904,6 +905,7 @@ export const locales = {
edit_partner: 'Éditer un partenaire',
changes_saved: 'Modifications enregistrées.',
an_error_occurred: "Une erreur s'est produite. Veuillez réessayer plus tard.",
error_verify_entered_data: "Une erreur s'est produite. Veuillez vérifier les données saisies.",
file_uploaded: 'Télécharger un fichier',
file_deleted: 'Fichier supprimé',
request_ocha_timed_out: "La requête auprès d'OCHA a expiré. Veuillez réessayer.",
Expand Down Expand Up @@ -1387,6 +1389,7 @@ export const locales = {
edit_partner: 'Edite el socio',
changes_saved: 'Cambios guardados.',
an_error_occurred: 'Se produjo un error; por favor, inténtelo de nuevo más tarde.',
error_verify_entered_data: 'Se produjo un error; por favor, verifique los datos ingresados',
file_uploaded: 'Archivo subido',
file_deleted: 'Archivo eliminado',
request_ocha_timed_out: 'Se ha agotado el tiempo de espera de la solicitud a OCHA. Por favor, inténtelo de nuevo.',
Expand Down Expand Up @@ -1872,6 +1875,7 @@ export const locales = {
edit_partner: 'Редактировать партнера',
changes_saved: 'Изменения сохранены',
an_error_occurred: 'Возникла ошибка, пожалуйста, попробуйте еще раз позже.',
error_verify_entered_data: 'произошла ошибка, проверьте введенные данные',
file_uploaded: 'Файл загружен.',
file_deleted: 'Файл удален.',
request_ocha_timed_out:
Expand Down Expand Up @@ -2355,6 +2359,7 @@ export const locales = {
edit_partner: 'Editar parceiro',
changes_saved: 'Mudanças salvas',
an_error_occurred: 'Ocorreu um erro. Por favor tente novamente mais tarde.',
error_verify_entered_data: 'Ocorreu um erro. Por favor verifique os dados inseridos',
file_uploaded: 'Arquivo uploaded',
file_deleted: 'Arquivo deletado.',
request_ocha_timed_out: 'Pedido do OCHA expirado. Favor tentar novamente',
Expand Down Expand Up @@ -2832,6 +2837,7 @@ export const locales = {
edit_partner: 'تحرير الشريك',
changes_saved: 'تم حفظ التغييرات.',
an_error_occurred: 'حدث خطأ، الرجاء المحاولة مرة أخرى لاحقا.',
error_verify_entered_data: 'حدث خطأ ، يرجى التحقق من البيانات المدخلة',
file_uploaded: 'ملف تم تحميله',
file_deleted: 'ملف تم خذفه',
request_ocha_timed_out: 'انتهت مدة الطلب المقدم الى مكتب تنسيق الشؤون الانسانية . الرجاء المحاولة مرة اخرى',
Expand Down
1 change: 1 addition & 0 deletions frontend_cluster/src_ts/styles/app-theme-cluster-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import '@polymer/paper-styles/color';
export const appThemeClusterStyles = html`
<style>
:host {
--primary-color: #0099ff;
--theme-primary-color: #009d55;
--theme-secondary-color-a: #ceffcc;
--theme-secondary-color-b: #88c245;
Expand Down
2 changes: 1 addition & 1 deletion frontend_ip/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<link rel="icon" href="images/favicon.ico">

<!-- See https://goo.gl/OOhYW5 -->
<link rel="manifest" href="/manifest.json">
<link rel="manifest" href="/ip/manifest.json">

<!-- See https://goo.gl/qRE0vM -->
<meta name="theme-color" content="#2E3AA1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import RoutingMixin from '../../etools-prp-common/mixins/routing-mixin';
import ProgressReportUtilsMixin from '../../mixins/progress-report-utils-mixin';
import UtilsMixin from '../../etools-prp-common/mixins/utils-mixin';
import LocalizeMixin from '../../etools-prp-common/mixins/localize-mixin';
import '@polymer/iron-icons/iron-icons';
import '@polymer/iron-icon/iron-icon';
import {
shouldDisplayLink,
getReportTitleFull,
Expand Down Expand Up @@ -38,12 +40,24 @@ class PdReportsReportTitle extends LocalizeMixin(
margin-left: 5px;
font-weight: bold;
}
.link-mode-icon {
height: 15px;
margin-right: 2px;
}
a {
color: var(--primary-color);
}
</style>
<etools-prp-permissions permissions="{{permissions}}"> </etools-prp-permissions>
<template is="dom-if" if="[[showLink]]" restamp="true">
<a href="[[_getReportLink(report, permissions)]]">[[_getReportTitle(report, localize)]]</a>
<a href="[[_getReportLink(report, permissions)]]">
<template is="dom-if" if="[[displayLinkIcon]]" restamp="true">
<iron-icon class="link-mode-icon" icon="[[_getReportIcon(report, permissions)]]"></iron-icon>
</template>
[[_getReportTitle(report, localize)]]
</a>
</template>
<template is="dom-if" if="[[!showLink]]" restamp="true"> [[_getReportTitleFull(report, localize)]] </template>
<template is="dom-if" if="[[_isFinalReport(report)]]" restamp="true">
Expand All @@ -61,6 +75,9 @@ class PdReportsReportTitle extends LocalizeMixin(
@property({type: Boolean})
displayLink = false;

@property({type: Boolean})
displayLinkIcon = false;

@property({type: Boolean, computed: '_shouldDisplayLink(displayLink, report, permissions)'})
showLink!: boolean;

Expand All @@ -86,6 +103,14 @@ class PdReportsReportTitle extends LocalizeMixin(
const suffix = this._getMode(report, permissions);
return getReportLink(report, suffix, this.buildUrl, this._baseUrl);
}

_getReportIcon(report: GenericObject, permissions: GenericObject) {
if (!permissions) {
return 'icons:visibility';
}
const suffix = this._getMode(report, permissions);
return suffix === 'view' ? 'icons:visibility' : 'icons:create';
}
}

window.customElements.define('pd-reports-report-title', PdReportsReportTitle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import LocalizeMixin from '../../etools-prp-common/mixins/localize-mixin';
import {tableStyles} from '../../etools-prp-common/styles/table-styles';
import {GenericObject} from '../../etools-prp-common/typings/globals.types';
import {getReportTitle} from './js/progress-reports-list-functions';
import '@unicef-polymer/etools-data-table/data-table-styles';

/**
* @polymer
Expand Down Expand Up @@ -100,7 +101,7 @@ class ProgressReportsList extends LocalizeMixin(
</span>
</div>
<div class="table-cell table-cell--text">
<pd-reports-report-title display-link report="[[report]]"></pd-reports-report-title>
<pd-reports-report-title display-link display-link-icon report="[[report]]"></pd-reports-report-title>
</div>
<div class="table-cell table-cell--text">
<report-status status="[[report.status]]" report-type="[[report.report_type]]"> </report-status>
Expand Down
6 changes: 6 additions & 0 deletions frontend_ip/src_ts/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ export const locales = {
edit_partner: 'Edit Partner',
changes_saved: 'Changes saved.',
an_error_occurred: 'An error occurred, please try again later.',
error_verify_entered_data: 'An error occured, please verify entered data.',
file_uploaded: 'File uploaded.',
file_deleted: 'File deleted.',
request_ocha_timed_out: 'Request to OCHA timed out. Please try again.',
Expand Down Expand Up @@ -910,6 +911,7 @@ export const locales = {
edit_partner: 'Éditer un partenaire',
changes_saved: 'Modifications enregistrées.',
an_error_occurred: "Une erreur s'est produite. Veuillez réessayer plus tard.",
error_verify_entered_data: "Une erreur s'est produite. Veuillez vérifier les données saisies.",
file_uploaded: 'Télécharger un fichier',
file_deleted: 'Fichier supprimé',
request_ocha_timed_out: "La requête auprès d'OCHA a expiré. Veuillez réessayer.",
Expand Down Expand Up @@ -1396,6 +1398,7 @@ export const locales = {
edit_partner: 'Edite el socio',
changes_saved: 'Cambios guardados.',
an_error_occurred: 'Se produjo un error; por favor, inténtelo de nuevo más tarde.',
error_verify_entered_data: 'Se produjo un error; por favor, verifique los datos ingresados',
file_uploaded: 'Archivo subido',
file_deleted: 'Archivo eliminado',
request_ocha_timed_out: 'Se ha agotado el tiempo de espera de la solicitud a OCHA. Por favor, inténtelo de nuevo.',
Expand Down Expand Up @@ -1884,6 +1887,7 @@ export const locales = {
edit_partner: 'Редактировать партнера',
changes_saved: 'Изменения сохранены',
an_error_occurred: 'Возникла ошибка, пожалуйста, попробуйте еще раз позже.',
error_verify_entered_data: 'произошла ошибка, проверьте введенные данные',
file_uploaded: 'Файл загружен.',
file_deleted: 'Файл удален.',
request_ocha_timed_out:
Expand Down Expand Up @@ -2370,6 +2374,7 @@ export const locales = {
edit_partner: 'Editar parceiro',
changes_saved: 'Mudanças salvas',
an_error_occurred: 'Ocorreu um erro. Por favor tente novamente mais tarde.',
error_verify_entered_data: 'Ocorreu um erro. Por favor verifique os dados inseridos',
file_uploaded: 'Arquivo uploaded',
file_deleted: 'Arquivo deletado.',
request_ocha_timed_out: 'Pedido do OCHA expirado. Favor tentar novamente',
Expand Down Expand Up @@ -2850,6 +2855,7 @@ export const locales = {
edit_partner: 'تحرير الشريك',
changes_saved: 'تم حفظ التغييرات.',
an_error_occurred: 'حدث خطأ، الرجاء المحاولة مرة أخرى لاحقا.',
error_verify_entered_data: 'حدث خطأ ، يرجى التحقق من البيانات المدخلة',
file_uploaded: 'ملف تم تحميله',
file_deleted: 'ملف تم خذفه',
request_ocha_timed_out: 'انتهت مدة الطلب المقدم الى مكتب تنسيق الشؤون الانسانية . الرجاء المحاولة مرة اخرى',
Expand Down
1 change: 1 addition & 0 deletions frontend_ip/src_ts/styles/app-theme-ip-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import '@polymer/paper-styles/color';
export const appThemeIpStyles = html`
<style>
:host {
--primary-color: #0099ff;
--theme-primary-color: #0099ff;
--theme-secondary-color-a: #ccebff;
--theme-secondary-color-b: #2baaff;
Expand Down

0 comments on commit 188ca00

Please sign in to comment.