You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we go to processBetsForDisplay we have to enter the time that the market was created at. In order to do this we have to make a query to the database. What would be nicer is to use the pre-built GetPublicResponseMarketByID() however this results in a circular import.
// Database connection
db := util.GetDB()
// Fetch bets for the market
bets := GetBetsForMarket(marketIDUint)
// feed in the time created
// note we are not using GetPublicResponseMarketByID because of circular import
var market models.Market
result := db.Where("ID = ?", marketIdStr).First(&market)
if result.Error != nil {
// Handle error, for example:
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
// Market not found
} else {
// Other error fetching market
}
return // Make sure to return or appropriately handle the error
}
// Process bets and calculate market probability at the time of each bet
betsDisplayInfo := processBetsForDisplay(market.CreatedAt, bets, db)
The text was updated successfully, but these errors were encountered:
In MarketBetsDisplayHandler()...
When we go to processBetsForDisplay we have to enter the time that the market was created at. In order to do this we have to make a query to the database. What would be nicer is to use the pre-built
GetPublicResponseMarketByID()
however this results in a circular import.The text was updated successfully, but these errors were encountered: