operx-cli 0.7.4__tar.gz → 0.7.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {operx_cli-0.7.4 → operx_cli-0.7.5}/PKG-INFO +1 -1
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/AGENTES.md +7 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/__init__.py +1 -1
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/personas.py +20 -3
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli.egg-info/PKG-INFO +1 -1
- {operx_cli-0.7.4 → operx_cli-0.7.5}/pyproject.toml +1 -1
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_sst_ambiental.py +20 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/README.md +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/agent_guide.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/api_fields.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/app.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/browser_login.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/client.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/__init__.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/account.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/ambiental.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/articulos.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/avisos.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/campos.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/common.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/completar.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/empresas.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/inventario.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/lecturas.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/ordenes.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/planta.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/preventivos.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/raw.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/registros.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/reportes.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/rutinas.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/search.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/sst.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/commands/update.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/lookup.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/output.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/record_completion.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/self_update.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/settings.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/shell.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/spreadsheet.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/updates.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/values.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli/welcome.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli.egg-info/SOURCES.txt +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli.egg-info/dependency_links.txt +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli.egg-info/entry_points.txt +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli.egg-info/requires.txt +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/operx_cli.egg-info/top_level.txt +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/setup.cfg +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_agentes.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_api_campos.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_app.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_articulos.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_campos.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_cards.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_client.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_completar.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_daily_flows.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_inventario_lecturas.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_json_writes.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_login.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_logout_and_routes.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_lookup.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_more_of_the_api.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_ordenes.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_output.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_personas.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_preventivos.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_record_completion.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_registros.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_rutinas.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_self_update.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_settings.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_shell.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_spreadsheet.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_updates.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_values.py +0 -0
- {operx_cli-0.7.4 → operx_cli-0.7.5}/tests/test_welcome.py +0 -0
|
@@ -50,6 +50,13 @@ llamada queda en el historial del token, marcada como hecha desde la CLI.
|
|
|
50
50
|
de una orden es `open`, `in_progress`, `on_hold`, `completed`, `verified` o
|
|
51
51
|
`cancelled`, y su `priority` es `low`, `medium`, `high` o `critical`. Las
|
|
52
52
|
opciones de los comandos van en español: `--estado en-progreso`.
|
|
53
|
+
- El `status` de una persona (`operx personas listar`, o `employees/` en
|
|
54
|
+
`operx api`) es lo que hace ahora y lo calcula el servidor; no se escribe, y
|
|
55
|
+
si lo mandas se ignora. En `--json` es `on_site` (tiene una visita abierta),
|
|
56
|
+
`away` (una ausencia aprobada la cubre ahora, sin decir de qué tipo), `off`
|
|
57
|
+
(la empresa usa Personas y no ha iniciado su jornada), `assigned` (está en
|
|
58
|
+
un trabajo abierto sin estar en sitio) o `available`. Filtra con
|
|
59
|
+
`operx api GET employees/ -q status=on_site`.
|
|
53
60
|
- Los resultados van a stdout y los avisos a stderr:
|
|
54
61
|
`operx equipos listar --todas --json > equipos.json` guarda solo los datos.
|
|
55
62
|
- `--csv` da un CSV para Excel (separado por punto y coma, con decimales con
|
|
@@ -74,7 +74,16 @@ def _show_report(answer, people):
|
|
|
74
74
|
print_rows(REPORT_COLUMNS, report, "tabla")
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
PEOPLE_COLUMNS = [
|
|
77
|
+
PEOPLE_COLUMNS = [
|
|
78
|
+
("user_name", "Nombre"), ("employee_code", "Código"), ("status", "Estado"),
|
|
79
|
+
("hire_date", "Ingreso"), ("is_active", "Activa"),
|
|
80
|
+
]
|
|
81
|
+
# What a person is doing right now. The API works it out (employees/availability.py)
|
|
82
|
+
# and nobody sets it; --json keeps the API's own words.
|
|
83
|
+
STATUS_LABELS = {
|
|
84
|
+
"available": "Disponible", "assigned": "Asignado", "on_site": "En sitio",
|
|
85
|
+
"away": "Ausente", "off": "Fuera de turno",
|
|
86
|
+
}
|
|
78
87
|
|
|
79
88
|
|
|
80
89
|
@app.command()
|
|
@@ -85,11 +94,19 @@ def listar(
|
|
|
85
94
|
as_json: JsonOption = False,
|
|
86
95
|
as_csv: CsvOption = False,
|
|
87
96
|
):
|
|
88
|
-
"""La gente de tu empresa que puedes ver, con su código
|
|
97
|
+
"""La gente de tu empresa que puedes ver, con su código y lo que hace ahora
|
|
98
|
+
(Estado: se calcula, no se escribe)."""
|
|
89
99
|
output = output_format(as_json, as_csv)
|
|
90
100
|
rows = list_rows(client_of(ctx), "employees", {"search": buscar}, todas)
|
|
91
101
|
if output != "json":
|
|
92
|
-
rows = [
|
|
102
|
+
rows = [
|
|
103
|
+
{
|
|
104
|
+
**row,
|
|
105
|
+
"hire_date": shown_moment(row.get("hire_date")),
|
|
106
|
+
"status": STATUS_LABELS.get(row.get("status"), row.get("status")),
|
|
107
|
+
}
|
|
108
|
+
for row in rows
|
|
109
|
+
]
|
|
93
110
|
print_rows(PEOPLE_COLUMNS, rows, output)
|
|
94
111
|
|
|
95
112
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "operx-cli"
|
|
7
|
-
version = "0.7.
|
|
7
|
+
version = "0.7.5"
|
|
8
8
|
description = "La línea de comandos de OperX: tu empresa desde la terminal, con tu token de API."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -246,3 +246,23 @@ def test_personas_listar():
|
|
|
246
246
|
|
|
247
247
|
assert result.exit_code == 0, result.output
|
|
248
248
|
assert "Empleado Smoke" in result.output and "T-02" in result.output
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def test_personas_listar_shows_what_each_person_is_doing_now_in_words():
|
|
252
|
+
rows = page(
|
|
253
|
+
{"id": 2, "user_id": 2, "user_name": "Ana Ruiz", "employee_code": "T-02", "status": "away", "is_active": True},
|
|
254
|
+
{"id": 3, "user_id": 3, "user_name": "Luis Paz", "employee_code": "T-03", "status": "off", "is_active": True},
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
result = run(FakeApi({("GET", "employees/"): rows}), "personas", "listar")
|
|
258
|
+
|
|
259
|
+
assert result.exit_code == 0, result.output
|
|
260
|
+
assert "Estado" in result.output and "Ausente" in result.output and "Fuera de turno" in result.output
|
|
261
|
+
assert "away" not in result.output
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def test_personas_listar_json_keeps_the_apis_status():
|
|
265
|
+
result = run(FakeApi({("GET", "employees/"): EMPLOYEES}), "personas", "listar", "--json")
|
|
266
|
+
|
|
267
|
+
assert result.exit_code == 0, result.output
|
|
268
|
+
assert '"status": "available"' in result.output
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|