Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancelar tickets no pagados en cron de sync de pagos #272

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

TextC0de
Copy link
Collaborator

@TextC0de TextC0de commented Sep 18, 2024

Este PR realiza las siguientes mejoras y correcciones:

  1. Cancela los tickets asociados a órdenes de compra expiradas en el cron de sincronización de pagos:

    • Se actualiza la lógica en clearExpiredPurchaseOrders para cancelar los tickets vinculados a órdenes expiradas.
    • Se agrega una prueba en scheduled.test.ts para verificar que los tickets se cancelen correctamente.
  2. Mejora la sincronización de pagos:

    • Se agrega una condición adicional en la consulta de órdenes no pagadas para incluir solo las que están en estado "open".

Copy link

socket-security bot commented Sep 18, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher

View full report↗︎

@@ -21,7 +21,7 @@ const googleMediaType = {
},
};

describe("Test email library", () => {
describe("Test email library on Google Import", () => {
Copy link
Collaborator Author

@TextC0de TextC0de Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Se renombraron nombres de tests repetidos

@@ -674,5 +675,19 @@ export const clearExpiredPurchaseOrders = async ({
)
.returning();

if (expiredOrders.length > 0) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Los tickets asociados a las ordenes expiradas deben ser cancelados para poder liberar ese stock

@@ -40,6 +40,7 @@ export const scheduled: ExportedHandlerScheduledHandler<ENV> = async (
const getUnpaidPurchaseOrders = await DB.query.purchaseOrdersSchema.findMany({
where: (po, { eq, and, isNotNull }) =>
and(
eq(po.status, "open"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solo necesitamos las ordenes que esten "open".
Las "complete" o "expired" no nos deberían interesar

Copy link

github-actions bot commented Sep 18, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 80.35% 13862 / 17250
🔵 Statements 80.35% 13862 / 17250
🔵 Functions 75.29% 387 / 514
🔵 Branches 80.6% 1014 / 1258
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/schema/purchaseOrder/actions.tsx 23.23% 61.53% 37.5% 23.23% 30-51, 54-142, 145-238, 241-309, 312-561, 583-584, 591-594, 637-638
workers/purchase_order_payment_sync_cron/scheduled.tsx 100% 100% 66.66% 100%
Generated in workflow #1170

@TextC0de TextC0de changed the title Cancelar tickets no pagados en cron de sync de pagos y actualizar vitest Cancelar tickets no pagados en cron de sync de pagos Sep 19, 2024
@TextC0de TextC0de merged commit 67721f8 into main Sep 23, 2024
6 checks passed
@TextC0de TextC0de deleted the textcode/purchase-status-cron-cancel-tickets branch September 23, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants