diff --git a/app/main.py b/app/main.py index d7ea238..267b9fd 100644 --- a/app/main.py +++ b/app/main.py @@ -103,6 +103,8 @@ async def login( except Exception as e: db.rollback() # Revertir cualquier cambio no confirmado raise e + finally: + db.close() if not user or not user.verify_password(password): return templates.TemplateResponse(request=request, name="login.html", context={"error": "Usuario o contraseƱa incorrectos"}) diff --git a/tests/test_main.py b/tests/test_main.py index 00bcc97..13cd65b 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -164,10 +164,9 @@ def test_find_best_combination(): [3, 3, 3, 3, 3, 3, 3, 3, 3], [4, 4, 4, 4, 4, 4, 4, 4, 4] ] - best_teams, min_difference, min_difference_total = find_best_combination(scores) + best_teams, min_difference_total = find_best_combination(scores) assert len(best_teams) == 1 - assert min_difference == 0 assert min_difference_total == 0 # Check if the teams are balanced