Skip to content

Commit

Permalink
Merge pull request #3481 from hotosm/develop
Browse files Browse the repository at this point in the history
v4.1.6 release
  • Loading branch information
willemarcel authored Aug 16, 2020
2 parents 872dace + 48fe204 commit a98e4c6
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 148 deletions.
1 change: 1 addition & 0 deletions backend/models/postgis/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,7 @@ def get_all_countries():
db.session.query(func.unnest(Project.country).label("country"))
.distinct()
.order_by("country")
.all()
)
tags_dto = TagsDTO()
tags_dto.tags = [r[0] for r in query]
Expand Down
24 changes: 11 additions & 13 deletions backend/services/stats_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def get_latest_activity(project_id: int, page: int) -> ProjectActivityDTO:
)
.join(User)
.filter(
TaskHistory.project_id == project_id, TaskHistory.action != "COMMENT"
TaskHistory.project_id == project_id,
TaskHistory.action != TaskAction.COMMENT.name,
)
.order_by(TaskHistory.action_date.desc())
.paginate(page, 10, True)
Expand All @@ -152,16 +153,16 @@ def get_latest_activity(project_id: int, page: int) -> ProjectActivityDTO:
@staticmethod
def get_popular_projects() -> ProjectSearchResultsDTO:
""" Get all projects ordered by task_history """

rate_func = func.count(TaskHistory.user_id) / extract(
"epoch", func.sum(cast(TaskHistory.action_date, Time))
)

query = TaskHistory.query.with_entities(
TaskHistory.project_id.label("id"), rate_func.label("rate")
)
# Implement filters.
query = (
query.filter(TaskHistory.action_date >= date.today() - timedelta(days=90))
TaskHistory.query.with_entities(
TaskHistory.project_id.label("id"), rate_func.label("rate")
)
.filter(TaskHistory.action_date >= date.today() - timedelta(days=90))
.filter(
or_(
TaskHistory.action == TaskAction.LOCKED_FOR_MAPPING.name,
Expand All @@ -170,17 +171,14 @@ def get_popular_projects() -> ProjectSearchResultsDTO:
)
.filter(TaskHistory.action_text is not None)
.filter(TaskHistory.action_text != "")
)
# Group by and order by.
sq = (
query.group_by(TaskHistory.project_id)
.group_by(TaskHistory.project_id)
.order_by(desc("rate"))
.limit(10)
.subquery()
)
projects_query = ProjectSearchService.create_search_query()
projects = projects_query.filter(Project.id == sq.c.id)

projects_query = ProjectSearchService.create_search_query()
projects = projects_query.filter(Project.id == query.c.id).all()
# Get total contributors.
contrib_counts = ProjectSearchService.get_total_contributions(projects)
zip_items = zip(projects, contrib_counts)
Expand Down Expand Up @@ -222,7 +220,7 @@ def get_last_activity(project_id: int) -> ProjectLastActivityDTO:
.filter(
TaskHistory.task_id == item.id,
TaskHistory.project_id == project_id,
TaskHistory.action != "COMMENT",
TaskHistory.action != TaskAction.COMMENT.name,
User.id == TaskHistory.user_id,
)
.order_by(TaskHistory.id.desc())
Expand Down
13 changes: 8 additions & 5 deletions backend/services/team_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ def get_all_teams(
TeamMembers.user_id == manager_filter,
TeamMembers.active == True, # noqa
TeamMembers.function == TeamMemberFunctions.MANAGER.value,
Team.id == TeamMembers.team_id,
)

manager_orgs_teams = query.filter(
Team.organisation_id.in_(
[
Expand All @@ -207,10 +209,11 @@ def get_all_teams(
]
)
)

query = manager_teams.union(manager_orgs_teams)

if team_name_filter:
query = query.filter(Team.name.contains(team_name_filter))
query = query.filter(Team.name.ilike("%" + team_name_filter + "%"),)

if team_role_filter:
try:
Expand All @@ -220,7 +223,7 @@ def get_all_teams(
.filter(ProjectTeams.role == role)
.subquery()
)
query = query.outerjoin(project_teams)
query = query.join(project_teams)
except KeyError:
pass

Expand All @@ -232,7 +235,7 @@ def get_all_teams(
)
.subquery()
)
query = query.outerjoin(team_member)
query = query.join(team_member)

if member_request_filter:
team_member = (
Expand All @@ -243,7 +246,7 @@ def get_all_teams(
)
.subquery()
)
query = query.outerjoin(team_member)
query = query.join(team_member)
if orgs_query:
query = query.union(orgs_query)

Expand Down Expand Up @@ -485,7 +488,7 @@ def is_user_team_manager(team_id: int, user_id: int):
if UserService.is_user_an_admin(user_id):
return True

managers = team.get_team_managers(team_id)
managers = team.get_team_managers()
for member in managers:
if member.user_id == user_id:
return True
Expand Down
18 changes: 9 additions & 9 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"license": "BSD-2-Clause",
"private": false,
"dependencies": {
"@formatjs/intl-pluralrules": "^3.2.5",
"@formatjs/intl-relativetimeformat": "^7.0.0",
"@formatjs/intl-utils": "^3.8.2",
"@formatjs/intl-pluralrules": "^3.3.1",
"@formatjs/intl-relativetimeformat": "^7.1.1",
"@formatjs/intl-utils": "^3.8.3",
"@formatjs/macro": "^0.2.8",
"@hotosm/id": "^2.18.4",
"@hotosm/iso-countries-languages": "^1.0.1",
"@hotosm/iso-countries-languages": "^1.0.2",
"@lokibai/react-use-copy-clipboard": "^1.0.4",
"@mapbox/geo-viewport": "^0.4.0",
"@mapbox/mapbox-gl-draw": "^1.1.2",
Expand All @@ -23,7 +23,7 @@
"@turf/intersect": "^6.1.3",
"@turf/line-to-polygon": "^6.0.1",
"@turf/transform-scale": "^5.1.5",
"@webscopeio/react-textarea-autocomplete": "^4.7.1",
"@webscopeio/react-textarea-autocomplete": "^4.7.2",
"axios": "^0.19.0",
"chart.js": "^2.9.3",
"dompurify": "^2.0.12",
Expand All @@ -32,7 +32,7 @@
"fromentries": "^1.2.1",
"humanize-duration": "^3.23.1",
"immutable": "^4.0.0-rc.12",
"mapbox-gl": "^1.11.1",
"mapbox-gl": "^1.12.0",
"mapbox-gl-draw-circle": "^1.1.1",
"mapbox-gl-draw-rectangle-mode": "^1.0.4",
"marked": "^1.1.1",
Expand All @@ -44,13 +44,13 @@
"react-chartjs-2": "^2.10.0",
"react-click-outside": "^3.0.1",
"react-dom": "^16.13.1",
"react-dropzone": "^11.0.2",
"react-dropzone": "^11.0.3",
"react-final-form": "^6.5.1",
"react-intl": "^5.4.7",
"react-intl": "^5.6.1",
"react-meta-elements": "^1.0.0",
"react-placeholder": "^4.0.3",
"react-redux": "^7.2.1",
"react-scripts": "^3.4.2",
"react-scripts": "^3.4.3",
"react-select": "^3.1.0",
"react-tooltip": "^4.2.8",
"reactjs-popup": "^1.5.0",
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"banner.privacyPolicy": "Zásady ochrany osobních údajů",
"banner.text": "Používáme cookies a podobné technologie k rozpoznání a analýze vašich návštěv a měření míry využití a aktivity provozu. Informace o tom, jak používáme údaje o vaší návštěvě, nebo informace, které nám poskytnete, se dozvíte na našem {link}. Kliknutím na „Souhlasím“ souhlasíte s používáním cookies.",
"comment.input.imageUpload.error": "Nahrávání obrázku se nezdařilo.",
"comment.input.imageUpload.progress": "",
"comment.input.imageUpload.progress": "Nahrávání souboru ...",
"comment.hashtags.help.managers": "Přidejte \"{hashtag}\" a informujte vedoucí projektu o vašem komentáři.",
"comment.hashtags.help.author": "Přidejte „{hashtag}“ a informujte autora projektu o vašem komentáři.",
"mytasks.mainSection.title": "Mé úlohy",
Expand Down Expand Up @@ -713,10 +713,10 @@
"user.notifications.mentions": "E-maily se zmínkami",
"user.notifications.mentions.description": "Obdržíte e-mail pokaždé, když je vaše uživatelské jméno uvedeno v komentáři.",
"user.notifications.projects": "Aktualizace projektu",
"user.notifications.tasks": "",
"user.notifications.tasks": "E-maily po validaci úloh",
"user.settings.required": "Povinná pole",
"user.notifications.projects.description": "Přijde vám oznámení, pokud v projektu, do kterého jste se zapojili, dojde k nějaké změně.",
"user.notifications.task.description": "",
"user.notifications.task.description": "Po validaci úlohy, ke které jste přispěli, obdržíte e-mail.",
"user.notifications.comments": "Komentáře",
"user.notifications.comments.description": "Obdrží oznámení pokaždé, když někdo zveřejní komentář k projektům nebo úkolům, ke kterým jste přispěli.",
"user.settings.become_validator.button": "Zjistit jak",
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/locales/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"banner.privacyPolicy": "מדיניות פרטיות",
"banner.text": "אנו משתמשים בעוגיות ובטכנולוגיות דומות כדי לזהות ולנתח את הביקורים שלך ולמדוד תעבורה ופעילות. ניתן ללמוד עוד על האופן בו אנו משתמשים בנתונים על הביקור שלך או במידע שמסופק על ידיך בקריאת {link}. לחיצה על „מקובל עלי” מהווה את הסכמתך לשימוש בעוגיות.",
"comment.input.imageUpload.error": "העלאת התמונה נכשלה.",
"comment.input.imageUpload.progress": "",
"comment.input.imageUpload.progress": "הקובץ נשלח…",
"comment.hashtags.help.managers": "ניתן להוסיף „{hashtag}” כדי להודיע למנהלי המיזם על ההערה שלך.",
"comment.hashtags.help.author": "ניתן להוסיף „{hashtag}” כדי להודיע ליוצרי המיזם על ההערה שלך.",
"mytasks.mainSection.title": "המשימות שלי",
Expand Down Expand Up @@ -713,10 +713,10 @@
"user.notifications.mentions": "הודעות דוא״ל על אזכורים",
"user.notifications.mentions.description": "לקבל הודעה על כל אזכור של שם המשתמש שלך בתגובה.",
"user.notifications.projects": "עדכוני מיזם",
"user.notifications.tasks": "",
"user.notifications.tasks": "הודעות דוא״ל לאימות משימות",
"user.settings.required": "שדות נדרשים",
"user.notifications.projects.description": "תישלח אליך התראה כאשר מיזם אליו תרמת יתקדם באופן כלשהו.",
"user.notifications.task.description": "",
"user.notifications.task.description": "לקבל הודעת דוא״ל כאשר משימה שתרמת לה עברה אימות.",
"user.notifications.comments": "הערות",
"user.notifications.comments.description": "לקבל הודעה בכל פעם ששמך מוזכר בתגובות שמפורסמות במיזמים או במשימות שתרמת להם.",
"user.settings.become_validator.button": "למידע כיצד",
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/locales/nl_NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"banner.privacyPolicy": "privacy-beleid",
"banner.text": "We gebruiken cookies en soortgelijke technologieën om u w bezoeken te herkennen en te analyseren, en gebruik en activiteiten te meten. U kunt zien hoe wij de gegevens over uw bezoek of informatie die u verschaft gebruiken door onze {link} te lezen. Door te klikken op \"Ik ga akkoord\" geeft u toestemming voor het gebruiken van cookies.",
"comment.input.imageUpload.error": "Uploaden van de afbeelding is mislukt.",
"comment.input.imageUpload.progress": "",
"comment.hashtags.help.managers": "",
"comment.hashtags.help.author": "",
"comment.input.imageUpload.progress": "Bestand uploaden…",
"comment.hashtags.help.managers": "Voeg \"{hashtag}\" toe om de projectbeheerders in kennis te stellen van uw opmerking.",
"comment.hashtags.help.author": "Voeg \"{hashtag}\" toe om de auteur van het project in kennis te stellen van uw opmerking.",
"mytasks.mainSection.title": "Mijn taken",
"mytasks.contribution": "Bijdragen",
"mytasks.filter.all": "Alle",
Expand Down Expand Up @@ -136,7 +136,7 @@
"project.typesOfMapping.landUse": "Grondgebruik",
"project.typesOfMapping.waterways": "Waterwegen",
"project.typesOfMapping.other": "Anders",
"project.typesOfMapping.pointsOfInterest": "",
"project.typesOfMapping.pointsOfInterest": "Interessante punten",
"notifications.mainSection.title": "Notificaties",
"notifications.filter.all": "Alle",
"notifications.filter.messages": "Berichten",
Expand All @@ -148,8 +148,8 @@
"notifications.navFilters.error": "Fout bij het laden van de {xWord} voor {yWord}",
"notifications.navFilters.error.simple": "Fout bij het laden van de {xWord}",
"notifications.pagination.count": "Weergegeven {number} van {total}",
"notifications.nav.new.one": "",
"notifications.nav.new.plural": "",
"notifications.nav.new.one": "1 nieuw bericht",
"notifications.nav.new.plural": "{n} nieuwe berichten",
"notifications.nav.viewAll": "Alles weergeven",
"notifications.nav.goToNotifications": "Ga naar notificaties",
"notifications.nav.noUnread": "Geen ongelezen berichten",
Expand Down Expand Up @@ -534,7 +534,7 @@
"project.selectTask.footer.button.mapSelectedTask": "Geselecteerde taak in kaart brengen",
"project.selectTask.footer.button.mapAnotherTask": "Een andere taak in kaart brengen",
"project.selectTask.footer.button.validateRandomTask": "Een taak valideren",
"project.selectTask.footer.button.validateSelectedTask": "{number, plural, one {} other {}}",
"project.selectTask.footer.button.validateSelectedTask": "{number, plural, one {Geselecteerde taak valideren} other {# geselecteerde taken valideren}}",
"project.selectTask.footer.button.validateAnotherTask": "Een andere taak valideren",
"project.selectTask.footer.button.selectAnotherProject": "Een ander project selecteren",
"project.selectTask.footer.button.resumeMapping": "Doorgaan met in kaart brengen",
Expand Down Expand Up @@ -713,10 +713,10 @@
"user.notifications.mentions": "Meldingen e-mails",
"user.notifications.mentions.description": "Ontvang een e-mail, elke keer als uw gebruikersnaam wordt vermeld in een opmerking.",
"user.notifications.projects": "Project updates",
"user.notifications.tasks": "",
"user.notifications.tasks": "E-mails voor valideren taken",
"user.settings.required": "Vereiste velden",
"user.notifications.projects.description": "U krijgt een notificatie als een project, waar u aan heeft bijgedragen, voortgang boekt.",
"user.notifications.task.description": "",
"user.notifications.task.description": "Ontvang een e-mail als een taak, waaraan u hebt bijgedragen, is gevalideerd.",
"user.notifications.comments": "Opmerkingen",
"user.notifications.comments.description": "Ontvang een notificatie, elke keer als iemand een opmerking toevoegt aan een project, waar u aan heeft bijgedragen.",
"user.settings.become_validator.button": "Leren hoe",
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/locales/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"banner.privacyPolicy": "політикою конфіденційності",
"banner.text": "Ми використовуємо реп'яшки та подібні технології для розпізнавання та аналізу ваших відвідувань, а також для вимірювання використання трафіку та дій. Ви можете дізнатись більше про те як ми використовуємо дані про ваші відвідування або інформацію, яку ви надаєте самі, ознайомившись з нашою {link}. Натискаючи \"Я погоджуюсь\" ви надаєте згоду на використання реп'яшків.",
"comment.input.imageUpload.error": "Помилка завантаження зображення.",
"comment.input.imageUpload.progress": "",
"comment.input.imageUpload.progress": "Завантаження файлу…",
"comment.hashtags.help.managers": "Додайте \"{hashtag}\", щоб повідомити менеджерів проєкту про ваш коментар.",
"comment.hashtags.help.author": "Додайте \"{hashtag}\", щоб повідомити автора проєкту про ваш коментар.",
"mytasks.mainSection.title": "Завдання",
Expand Down Expand Up @@ -713,10 +713,10 @@
"user.notifications.mentions": "Листи зі згадками",
"user.notifications.mentions.description": "Отримувати листа кожного разу коли вас згадуватимуть в коментарях.",
"user.notifications.projects": "Оновлення проекту",
"user.notifications.tasks": "",
"user.notifications.tasks": "Сповіщати на пошту про перевірку завдань",
"user.settings.required": "Обов'язкові поля",
"user.notifications.projects.description": "Ви отримуватимете оповіщення з будь-яких проєктів в яких ви взяли участь у разі їх подальшого розвитку.",
"user.notifications.task.description": "",
"user.notifications.task.description": "Ви отримуватимете сповіщення щодо перевірки замаплених вами завдань.",
"user.notifications.comments": "Коментарі",
"user.notifications.comments.description": "Отримувати повідомлення кожного разу, як хтось залишатиме коментар в проєкті чи завданні до якого ви доклали зусиль.",
"user.settings.become_validator.button": "Дізнатись як",
Expand Down
Loading

0 comments on commit a98e4c6

Please sign in to comment.