7 #include <scorum/utils/range_adaptors.hpp>
9 #include <boost/range/algorithm/sort.hpp>
10 #include <boost/range/algorithm/set_algorithm.hpp>
21 , _account_service(services.account_service())
23 , _game_service(services.game_service())
32 FC_ASSERT(_game_service.
is_exists(op.
uuid),
"Game with uuid '${g}' doesn't exist", (
"g", op.
uuid));
37 const fc::flat_set<market_type> set_of_markets(op.
markets.begin(), op.
markets.end());
39 FC_ASSERT(set_of_markets.size() == op.
markets.size(),
"You provided duplicates in market list.",
40 (
"input_markets", op.
markets)(
"set_of_markets", set_of_markets));
45 fc::flat_set<market_type> cancelled_markets;
46 boost::set_difference(game.markets, set_of_markets, std::inserter(cancelled_markets, cancelled_markets.end()));
49 "Cannot cancel markets after game was started");
51 _betting_service.
cancel_bets(game.uuid, cancelled_markets);
update_game_markets_evaluator(data_service_factory_i &services, betting_service_i &)
void do_apply(const operation_type &op)
void validate_game(const game_type &game, const fc::flat_set< market_type > &markets)
void validate_markets(const fc::flat_set< market_type > &markets)
virtual void check_account_existence(const account_name_type &, const optional< const char * > &context_type_name=optional< const char * >()) const =0
virtual bool is_betting_moderator(const account_name_type &account_name) const =0
virtual void cancel_bets(uuid_type game_uuid)=0
virtual const game_object & get_game(int64_t game_id) const =0
virtual void update_markets(const game_object &game, const fc::flat_set< market_type > &markets)=0
virtual bool is_exists(int64_t game_id) const =0
This operation updates game markets list.
uuid_type uuid
Universal Unique Identifier which is specified during game creation.
account_name_type moderator
moderator account name
std::vector< market_type > markets
list of markets