+
{sweepstake.name} (ID: {sweepstake.id})
@@ -103,8 +102,10 @@ function SweepstakeDetail({
Last refresh: {timeAgo(sweepstake.updated_at)}
-
-
+
);
}
diff --git a/sweepy-ui/src/components/SweepstakesTableTabbed.jsx b/sweepy-ui/src/components/SweepstakesTableTabbed.jsx
new file mode 100644
index 0000000..6b65da1
--- /dev/null
+++ b/sweepy-ui/src/components/SweepstakesTableTabbed.jsx
@@ -0,0 +1,67 @@
+import React, { useState } from "react";
+
+import ParticipantTable from "./ParticipantTable";
+import LeaderboardTable from "./LeaderboardTable";
+import SweepstakeHistoryChart from "./SweepstakeHistoryChart";
+
+const SweepstakeTableTabbed = ({ sweepstake, history }) => {
+ const [activeTab, setActiveTab] = useState("participant"); // Default to participant tab
+
+ const renderContent = () => {
+ switch (activeTab) {
+ case "participant":
+ return
;
+ case "history":
+ return
;
+ case "leaderboard":
+ return
;
+ default:
+ return null;
+ }
+ };
+
+ return (
+
+ {/* Tab Buttons */}
+
+
+
+ {sweepstake.tournament_id && (
+
+ )}
+
+
+ {/* Tab Content */}
+
{renderContent()}
+
+ );
+};
+
+export default SweepstakeTableTabbed;
diff --git a/sweepy-ui/src/utils/format.js b/sweepy-ui/src/utils/format.js
new file mode 100644
index 0000000..fb4a3ee
--- /dev/null
+++ b/sweepy-ui/src/utils/format.js
@@ -0,0 +1,19 @@
+export function stringifyScore(score) {
+ if (score === null || score === undefined) {
+ return "-";
+ } else if (score === 0) {
+ return "E";
+ } else if (score > 0) {
+ return `+${score}`;
+ } else {
+ return `${score}`;
+ }
+}
+
+export function percentifyProbability(prob) {
+ if (prob === null || prob === undefined) {
+ return "-";
+ } else {
+ return `${(parseFloat(prob) * 100).toFixed(2)}%`;
+ }
+}
diff --git a/sweepy/generate_sweepstakes.py b/sweepy/generate_sweepstakes.py
index aa35a41..ee0dae6 100644
--- a/sweepy/generate_sweepstakes.py
+++ b/sweepy/generate_sweepstakes.py
@@ -202,7 +202,7 @@ def refresh_sweepstake_odds(
Refresh the sweepstake by re-fetching the market data and updating the participants.
"""
- latest_data = get_selections(client, sweepstake_db.market_id, False)
+ latest_data = get_selections(client, sweepstake_db.market_id)
fetched_at = datetime.datetime.now(datetime.timezone.utc)
if not latest_data:
raise MarketNotFoundException(
diff --git a/sweepy/models/sweepstakes.py b/sweepy/models/sweepstakes.py
index aa9d874..9fb9e8c 100644
--- a/sweepy/models/sweepstakes.py
+++ b/sweepy/models/sweepstakes.py
@@ -9,7 +9,7 @@ class RunnerOdds(BaseModel):
provider_id: str
name: str
implied_probability: Decimal = condecimal(ge=0, le=1)
- score: Decimal | None = None
+ score: int | None = None
def __le__(self, other: "RunnerOdds") -> bool:
return self.implied_probability <= other.implied_probability