translator_directory.cli
Attributes
Functions
|
Implements the fetch-users cli command. |
|
Updates the list of users by fetching matching users |
|
|
|
|
|
Updates user accounts for translators. |
|
Create languages for the selected translator schema. Languages get |
This command forcefully deletes all languages from the database and all |
|
Recalculate travel compensation and distance for open time reports. |
|
Import contract numbers from Excel file and update translators. |
|
Change the finanzstelle of a time report by ticket ID. |
Module Contents
- translator_directory.cli.fetch_users(app: onegov.translator_directory.app.TranslatorDirectoryApp, session: sqlalchemy.orm.Session, ldap_server: str, ldap_username: str, ldap_password: str, admin_group: str, editor_group: str, verbose: bool = False, skip_deactivate: bool = False, dry_run: bool = False) None[source]
Implements the fetch-users cli command.
- translator_directory.cli.fetch_users_cli(ldap_server: str, ldap_username: str, ldap_password: str, admin_group: str, editor_group: str, verbose: bool, skip_deactivate: bool, dry_run: bool) collections.abc.Callable[[onegov.translator_directory.request.TranslatorAppRequest, onegov.translator_directory.app.TranslatorDirectoryApp], None][source]
Updates the list of users by fetching matching users from a remote LDAP server.
This is currently highly specific for the Canton of Zug and therefore most values are hard-coded.
Example: .. code-block:: bash
- onegov-translator –select /translator_directory/zug fetch-users
–ldap-server ‘ldaps://1.2.3.4’ –ldap-username ‘foo’ –ldap-password ‘bar’ –admin-group ‘ou=Admins’ –editor-group ‘ou=Editors’
- translator_directory.cli.drive_distances_cli(dry_run: bool, only_empty: bool, tolerance_factor: float, max_tolerance: int, max_distance: int) collections.abc.Callable[[onegov.translator_directory.request.TranslatorAppRequest, onegov.translator_directory.app.TranslatorDirectoryApp], None][source]
- translator_directory.cli.geocode_cli(dry_run: bool, only_empty: bool) collections.abc.Callable[[onegov.translator_directory.request.TranslatorAppRequest, onegov.translator_directory.app.TranslatorDirectoryApp], None][source]
- translator_directory.cli.update_accounts_cli(dry_run: bool) collections.abc.Callable[[onegov.translator_directory.request.TranslatorAppRequest, onegov.translator_directory.app.TranslatorDirectoryApp], None][source]
Updates user accounts for translators.
- translator_directory.cli.LANGUAGES = ('Afrikaans', 'Albanisch', 'Amharisch', 'Anyin', 'Arabisch', 'Arabisch (Dialekte)', 'Arabisch...[source]
- translator_directory.cli.create_languages(dry_run: bool) collections.abc.Callable[[onegov.translator_directory.request.TranslatorAppRequest, onegov.translator_directory.app.TranslatorDirectoryApp], None][source]
Create languages for the selected translator schema. Languages get created if they don’t exist to prevent id changes.
This command is useful when new languages were added to the LANGUAGES list.
NOTE: No language will be deleted. If a language is not in the LANGUAGES list the script will print a message.
- Example:
onegov-translator –select /translator_directory/schaffhausen create-languages –dry-run
- translator_directory.cli.force_delete_languages(dry_run: bool) collections.abc.Callable[[onegov.translator_directory.request.TranslatorAppRequest, onegov.translator_directory.app.TranslatorDirectoryApp], None][source]
This command forcefully deletes all languages from the database and all references will be lost. This command is useful after the languages have changed and assigned a lot for testing.
- Example:
onegov-translator –select /translator_directory/schaffhausen delete-languages –dry-run
- translator_directory.cli.recalculate_travel_details_cli(dry_run: bool, status: str) collections.abc.Callable[[onegov.translator_directory.request.TranslatorAppRequest, onegov.translator_directory.app.TranslatorDirectoryApp], None][source]
Recalculate travel compensation and distance for open time reports.
This fixes incorrect travel calculations due to old logic errors. Only updates reports that have not yet been exported to accounting.
- Example:
- onegov-translator –select /translator_directory/zug
recalculate-travel-details –dry-run
- translator_directory.cli.import_contract_numbers_cli(file: str, dry_run: bool) collections.abc.Callable[[onegov.translator_directory.request.TranslatorAppRequest, onegov.translator_directory.app.TranslatorDirectoryApp], None][source]
Import contract numbers from Excel file and update translators.
The Excel file must have columns: - ‘Ma-Nr.’ (personnel number, preferred for matching) - ‘Vertragsnummer’ (contract number to update) - ‘Mitarbeiter’ (optional, used as fallback for name-based matching)
If translator not found by Ma-Nr., will search by name from Mitarbeiter column (supports formats: “Lastname, Firstname” or “Firstname Lastname”).
- Example:
- onegov-translator –select /translator_directory/schaffhausen
import-contract-numbers -f /tmp/file.xlsx –dry-run
- translator_directory.cli.change_finanzstelle_cli(ticket_id: str, finanzstelle: str, dry_run: bool) collections.abc.Callable[[onegov.translator_directory.request.TranslatorAppRequest, onegov.translator_directory.app.TranslatorDirectoryApp], None][source]
Change the finanzstelle of a time report by ticket ID.
- Example:
- onegov-translator –select /translator_directory/schaffhausen
change-finanzstelle -t TRP-2024-00123 -f polizei –dry-run