Skip to content

Commit

Permalink
Merge pull request #190 from twilio-labs/fix/badgeFormatting
Browse files Browse the repository at this point in the history
Fix/badge formatting
  • Loading branch information
IObert authored Oct 11, 2024
2 parents fa2f42e + 32b039a commit 151e192
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/app/event/[slug]/orders/ordersList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function OrdersList({
value="cancelled"
>
Cancelled
{event?.cancelledCount && (
{event?.cancelledCount != undefined && (
<Badge className="ml-1">{event?.cancelledCount}</Badge>
)}
</TabsTrigger>
Expand All @@ -81,7 +81,7 @@ export default function OrdersList({
value="delivered"
>
Delivered
{event?.deliveredCount && (
{event?.deliveredCount != undefined && (
<Badge className="ml-1">{event?.deliveredCount}</Badge>
)}
</TabsTrigger>
Expand Down
23 changes: 18 additions & 5 deletions src/scripts/clearOrdersForEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,26 @@ const client = twilio(TWILIO_API_KEY, TWILIO_API_SECRET, {
accountSid: TWILIO_ACCOUNT_SID,
});

const eventName = "wwc-2024";
const eventName = process.argv.pop();

if (!eventName || eventName.startsWith("/") || eventName.includes("=")) {
console.error("Please provide an event name as the last argument, e.g. 'pnpm clear-orders wearedevs24'");
process.exit(1);
}

(async () => {
await updateSyncMapItem("Events", eventName, {
cancelledCount: 0,
deliveredCount: 0,
});
try {
await updateSyncMapItem("Events", eventName, {
cancelledCount: 0,
deliveredCount: 0,
});
} catch (e: any) {
if (e.code === 20404) {
console.error(`Event ${eventName} not found`);
process.exit(0);
}
console.error(e);
}

console.log(
`Reset event stats "cancelledCount" and "deliveredCount" for ${eventName}`,
Expand Down

0 comments on commit 151e192

Please sign in to comment.