Skip to content

Commit d652cb6

Browse files
GeObtsclaude
andcommitted
feat(manager): add tandaCount view for frontend pagination
Exposes the total number of tandas ever created (across all states). Equals nextTandaId - 1 since IDs start at 1. Returns 0 before the first tanda exists. Frontends paginating "all tandas" lists need this; it's cleaner than having them compute nextTandaId - 1 themselves. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9d6ffaa commit d652cb6

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/TandaManager.sol

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,17 @@ contract TandaManager is VRFConsumerBaseV2Plus, Pausable {
748748
return addressToTandaId[candidate] != 0;
749749
}
750750

751+
/// @notice Total number of tandas ever created by this Manager.
752+
/// @dev Equals `nextTandaId - 1` (since IDs start at 1). Includes
753+
/// tandas in every state: OPEN, ACTIVE, and COMPLETED.
754+
/// Returns 0 before any tanda has been created.
755+
/// @return count Total tandas created.
756+
function tandaCount() external view returns (uint256 count) {
757+
unchecked {
758+
count = nextTandaId == 0 ? 0 : nextTandaId - 1;
759+
}
760+
}
761+
751762
// ─────────────────────────────────────────────────────────────────────
752763
// Owner — pause / unpause
753764
// ─────────────────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)