Skip to content

Commit

Permalink
This commit solve a error in the pqrs that don't match to uppercase
Browse files Browse the repository at this point in the history
  • Loading branch information
Heibert committed May 3, 2024
1 parent 4357675 commit 6367b06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions INSIGHTSAPI/pqrs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def create(self, request, *args, **kwargs):
response = super().create(request, *args, **kwargs)
if response.status_code == status.HTTP_201_CREATED:
options = {
"test": settings.EMAIL_TEST,
"TEST": settings.EMAIL_TEST,
"EJECUTIVO": "PABLO.CASTANEDA@CYC-BPO.COM",
"GERENCIA GENERAL": "CESAR.GARZON@CYC-BPO.COM",
"GERENCIA DE RIESGO Y CONTROL INTERNO": "MARIO.GIRON@CYC-BPO.COM",
Expand All @@ -57,13 +57,13 @@ def create(self, request, *args, **kwargs):
"GERENCIA DE OPERACIONES": "ADRIANA.PAEZ@CYC-BPO.COM",
"GERENCIA DE MERCADEO": "HECTOR.SOTELO@CYC-BPO.COM",
}
email = options.get(self.request.data["area"].lower())
email = options.get(self.request.data["area"].upper())
if not email:
mail_admins(
"Error en PQRS",
f"El area {self.request.data['area']} no tiene un correo asociado.",
)
return Response(status=status.HTTP_500_INTERNAL_SERVER_ERROR, data=f"El tipo {self.request.data['area']} no tiene un correo asociado.")
return Response(status=status.HTTP_500_INTERNAL_SERVER_ERROR, data=f"El area {self.request.data['area']} no tiene un correo asociado.")
if settings.DEBUG or "test" in sys.argv:
cc_emails = ["juan.carreno@cyc-bpo.com"]
else:
Expand Down
6 changes: 3 additions & 3 deletions INSIGHTSAPI/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ def update_user(request):
# Connect to the non-Django app's database
with connections['staffnet'].cursor() as cursor:
# Dynamically construct the SQL query
query = 'UPDATE users SET '
query = 'UPDATE personal_information SET '
for key, value in request.POST.items():
query += f'{key} = "{value}", '
query = query[:-2] + ' WHERE id = %s'
query = query[:-2] + ' WHERE cedula = %s'
# Execute the query
print(query)
if 'test' not in sys.argv:
if 'test' in sys.argv:
cursor.execute(query, (request.user.cedula,))
return Response({'message': 'User updated successfully'})
except Error as e:
Expand Down

0 comments on commit 6367b06

Please sign in to comment.