Skip to content

feat: add get_active_events_count view#348

Merged
Yunusabdul38 merged 2 commits intoAgora-Events:mainfrom
JTKaduma:feat/get-active-events-count-view
Mar 28, 2026
Merged

feat: add get_active_events_count view#348
Yunusabdul38 merged 2 commits intoAgora-Events:mainfrom
JTKaduma:feat/get-active-events-count-view

Conversation

@JTKaduma
Copy link
Copy Markdown
Contributor

Summary

This PR adds a new public contract view, get_active_events_count(env: Env) -> u32, to expose the number of currently active events on the platform. This gives frontend clients a simple way to display platform activity metrics without having to fetch and filter all events client-side.

What Changed

  • Added get_active_events_count(env: Env) -> u32 to the event registry contract
  • Introduced a persistent GlobalActiveEventCount storage key
  • Wired active event count updates into event storage lifecycle logic so the counter stays accurate when events are:
    • registered
    • activated/deactivated
    • cancelled
    • archived
  • Added a unit test covering active count accuracy across these state transitions

Why

Frontends need a lightweight way to show platform activity metrics. Returning the active event count directly from the contract avoids extra client work and keeps the query efficient.

Testing

  • Added unit test for active event count tracking
  • Verified with:
cargo test -p event-registry

Closes #315

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 28, 2026

@JTKaduma is attempting to deploy a commit to the oseh-svg's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 28, 2026

@JTKaduma Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Yunusabdul38 Yunusabdul38 merged commit c1fda1e into Agora-Events:main Mar 28, 2026
3 of 4 checks passed
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.

[Contract] Add get_active_events_count view

2 participants