Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename phase to lifecycle #290

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions amt/locale/base.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-17 13:18+0000\n"
"POT-Creation-Date: 2024-10-20 07:35+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -397,7 +397,8 @@ msgid "Algorithm system name"
msgstr ""

#: amt/site/templates/parts/filter_list.html.j2:99
msgid "Phase"
#: amt/site/templates/projects/new.html.j2:37
msgid "Lifecycle"
msgstr ""

#: amt/site/templates/parts/header.html.j2:7
Expand Down Expand Up @@ -602,10 +603,6 @@ msgstr ""
msgid "Your algorithm system name here"
msgstr ""

#: amt/site/templates/projects/new.html.j2:37
msgid "Lifecycle"
msgstr ""

#: amt/site/templates/projects/new.html.j2:39
msgid "Select the lifecycle your algorithm system is currently in."
msgstr ""
Expand Down
Binary file modified amt/locale/en_US/LC_MESSAGES/messages.mo
Binary file not shown.
15 changes: 9 additions & 6 deletions amt/locale/en_US/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-17 13:18+0000\n"
"POT-Creation-Date: 2024-10-20 07:35+0200\n"
"PO-Revision-Date: 2024-07-25 21:01+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en_US\n"
Expand Down Expand Up @@ -398,7 +398,8 @@ msgid "Algorithm system name"
msgstr ""

#: amt/site/templates/parts/filter_list.html.j2:99
msgid "Phase"
#: amt/site/templates/projects/new.html.j2:37
msgid "Lifecycle"
msgstr ""

#: amt/site/templates/parts/header.html.j2:7
Expand Down Expand Up @@ -603,10 +604,6 @@ msgstr ""
msgid "Your algorithm system name here"
msgstr ""

#: amt/site/templates/projects/new.html.j2:37
msgid "Lifecycle"
msgstr ""

#: amt/site/templates/projects/new.html.j2:39
msgid "Select the lifecycle your algorithm system is currently in."
msgstr ""
Expand Down Expand Up @@ -713,3 +710,9 @@ msgstr ""
#~ "manner."
#~ msgstr ""

#~ msgid "Lifecyle"
#~ msgstr ""

#~ msgid "Phase"
#~ msgstr ""

Binary file modified amt/locale/nl_NL/LC_MESSAGES/messages.mo
Binary file not shown.
17 changes: 4 additions & 13 deletions amt/locale/nl_NL/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-10-17 13:18+0000\n"
"POT-Creation-Date: 2024-10-20 07:35+0200\n"
"PO-Revision-Date: 2024-07-25 21:01+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: nl_NL\n"
Expand Down Expand Up @@ -416,8 +416,9 @@ msgid "Algorithm system name"
msgstr "Algoritme systeem naam"

#: amt/site/templates/parts/filter_list.html.j2:99
msgid "Phase"
msgstr "Fase"
#: amt/site/templates/projects/new.html.j2:37
msgid "Lifecycle"
msgstr "Levenscyclus"

#: amt/site/templates/parts/header.html.j2:7
msgid "Beta Version"
Expand Down Expand Up @@ -623,10 +624,6 @@ msgstr "Algoritmekader"
msgid "Your algorithm system name here"
msgstr "Jouw algoritme systeem naam hier"

#: amt/site/templates/projects/new.html.j2:37
msgid "Lifecycle"
msgstr "Levenscyclus"

#: amt/site/templates/projects/new.html.j2:39
msgid "Select the lifecycle your algorithm system is currently in."
msgstr ""
Expand Down Expand Up @@ -689,9 +686,3 @@ msgstr "Creëer Algoritme Systeem"
msgid "Copy results and close"
msgstr "Resultaten overnemen en sluiten"

#~ msgid "About us"
#~ msgstr "Over ons"

#~ msgid "Contact"
#~ msgstr "Contact"

12 changes: 6 additions & 6 deletions amt/repositories/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
logger = logging.getLogger(__name__)


def sort_by_phase(project: Project) -> int:
def sort_by_lifecycle(project: Project) -> int:
if project.lifecycle:
return project.lifecycle.index
else:
return -1


def sort_by_phase_reversed(project: Project) -> int:
def sort_by_lifecycle_reversed(project: Project) -> int:
if project.lifecycle:
return -project.lifecycle.index
else:
Expand Down Expand Up @@ -105,11 +105,11 @@ def paginate( # noqa
result = list(self.session.execute(statement).scalars())
# todo: the good way to do sorting is to use an enum field (or any int field)
# in the database so we can sort on that
if result and sort and "phase" in sort:
if sort["phase"] == "ascending":
result = sorted(result, key=sort_by_phase)
if result and sort and "lifecycle" in sort:
if sort["lifecycle"] == "ascending":
result = sorted(result, key=sort_by_lifecycle)
else:
result = sorted(result, key=sort_by_phase_reversed)
result = sorted(result, key=sort_by_lifecycle_reversed)
return result # noqa
except Exception as e:
logger.exception("Error paginating projects")
Expand Down
4 changes: 2 additions & 2 deletions amt/site/templates/parts/filter_list.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
{{ sort_button('name', sort_by) }}
</th>
<th scope="col" class="rvo-table-header">
{% trans %}Phase{% endtrans %}
{{ sort_button('phase', sort_by) }}
{% trans %}Lifecycle{% endtrans %}
{{ sort_button('lifecycle', sort_by) }}
</th>
<th scope="col" class="rvo-table-header" style="white-space: nowrap">
{% trans %}Last updated{% endtrans %}
Expand Down
Loading