asistencias.py
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- Under an hour
- Newbie friendliness
- 15/100
Research direction
The pasted file is a Python attendance-control script, not code from this JavaScript/TypeScript repository, and the issue does not say what to change. The visible defects are a stray backtick in registrar_empleado (printi/n¨...), a backtick before from datetime import datetime at the top, and the label sALIDA in mostrar_registro. Confirm with the author what is wanted before editing, then run the script with python asistencias.py to check that it starts.
Written by the indexing model from the issue text.
Description
from datetime import datetime
===================== CLASE EMPLEADO =====================
class Empleado:
def init(self, numero, nombre, puesto):
self.numero = numero
self.nombre = nombre
self.puesto = puesto
self.entrada = None
self.salida = None
def registrar_entrada(self):
if self.entrada is None:
self.entrada = datetime.now()
print(f"\nEntrada registrada para: {self.nombre}")
print(f"Hora: {self.entrada.strftime('%d/%m/%Y %H:%M:%S')}")
else:
print(f"\n {self.nombre} ya tiene una entrada registrada.")
def registrar_salida(self):
if self.entrada is None:
print(f"\n {self.nombre} no tiene entrada registrada.")
elif self.salida is None:
self.salida = datetime.now()
print(f"\nSalida registrada para: {self.nombre}")
print(f"🕐 Hora: {self.salida.strftime('%d/%m/%Y %H:%M:%S')}")
else:
print(f"\n {self.nombre} ya tiene una salida registrada.")
def mostrar_registro(self):
print("\n" + "-" * 40)
print(f"NÚMERO: {self.numero}")
print(f"NOMBRE: {self.nombre}")
print(f"PUESTO: {self.puesto}")
if self.entrada:
print(f"ENTRADA: {self.entrada.strftime('%d/%m/%Y %H:%M:%S')}")
else:
print(f"ENTRADA: Sin registro")
if self.salida:
print(f"SALIDA: {self.salida.strftime('%d/%m/%Y %H:%M:%S')}")
else:
print(f"sALIDA: Sin registro")
print("-" * 40)
===================== CLASE CONTROL DE ASISTENCIA =====================
class ControlAsistencia:
def init(self):
self.empleados = {}
def registrar_empleado(self):
print("\n" + "=" * 40)
print(" REGISTRAR EMPLEADO")
print("=" * 40)
numero = input("Número de empleado: ")
if numero in self.empleados:
`printi/n¨El empleado ya está registrado.")
return
nombre = input("👤 Nombre completo: ")
puesto = input("💼 Puesto: ")
self.empleados[numero] = Empleado(numero, nombre, puesto)
print("✅ Empleado registrado correctamente.")
def buscar_empleado(self):
print("\n" + "=" * 40)
numero = input("🔢 Número de empleado: ")
if numero in self.empleados:
return self.empleados[numero]
print("❌ Empleado no encontrado.")
return None
def registrar_entrada(self):
print("\n" + "=" * 40)
print(" REGISTRAR ENTRADA")
print("=" * 40)
empleado = self.buscar_empleado()
if empleado:
empleado.registrar_entrada()
def registrar_salida(self):
print("\n" + "=" * 40)
print(" REGISTRAR SALIDA")
print("=" * 40)
empleado = self.buscar_empleado()
if empleado:
empleado.registrar_salida()
def mostrar_registros(self):
print("\n" + "=" * 40)
print(" LISTA DE REGISTROS")
print("=" * 40)
if not self.empleados:
print("📭 No hay empleados registrados.")
return
for empleado in self.empleados.values():
empleado.mostrar_registro()
===================== PROGRAMA PRINCIPAL =====================
def main():
sistema = ControlAsistencia()
while True:
print("\n" + "=" * 40)
print(" SISTEMA DE CONTROL DE ASISTENCIA")
print("=" * 40)
print(" 1 → Registrar empleado")
print(" 2 → Registrar entrada")
print(" 3 → Registrar salida")
print(" 4 → Mostrar todos los registros")
print(" 5 → Salir del sistema")
print("=" * 40)
opcion = input("👉 Elige una opción: ")
if opcion == "1":
sistema.registrar_empleado()
elif opcion == "2":
sistema.registrar_entrada()
elif opcion == "3":
sistema.registrar_salida()
elif opcion == "4":
sistema.mostrar_registros()
elif opcion == "5":
print("\n👋 Sistema finalizado. ¡Hasta luego!")
break
else:
print("\n❌ Opción no válida. Intenta nuevamente.")
Ejecutar el programa
if name == "main":
main()
- Dominant language
- TypeScript
- Stars
- 104
- Forks
- 36
- Avg merge
- 4d 23h
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from serpapi/serpapi-javascript
-
Default client timeout (60s) is shorter than the server-side timeout (90s)Possibly taken @Babyy-dev claimed this 6 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Deno deprecationPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 50/100
serpapi/serpapi-javascript#55 · 2 comments ·
-
Timeout issuesOpen
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
types are extremely poor without coverage.Possibly taken @nya-a-cat claimed this 151 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
serpapi/serpapi-javascript#33 · 1 comment · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
All issues in serpapi/serpapi-javascript
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
superlinked/sie#1033 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
remix-run/react-router#15838 ·
Maintainers usually reply within 1 day
-
area/ci bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
melgarafael/DeskcommCRM#5290 ·
Maintainers usually reply within 1 day