get_tournaments and get_tournaments_by_state method added

This commit is contained in:
kstdl 2017-02-20 18:09:37 +03:00
parent 4674fc53ab
commit 895fbec5bc
8 changed files with 670 additions and 504 deletions

2
.gitmodules vendored
View file

@ -4,5 +4,5 @@
ignore = dirty
[submodule "libraries/fc"]
path = libraries/fc
url = git@git.syncad.com:blocktrades/fc.git
url = git@gitlab.pixelplex.by:595_peerplays/fc.git
ignore = dirty

View file

@ -1,224 +1,330 @@
{
"initial_timestamp": "2016-11-29T21:00:00",
"max_core_supply": "100000000000",
"initial_timestamp": "2017-01-10T08:52:15",
"max_core_supply": "1000000000000000",
"initial_parameters": {
"current_fees": {
"parameters": [[
0,{
"fee": 2000000,
"price_per_kbyte": 1000000
"parameters": [
[
0,
{
"fee": 200,
"price_per_kbyte": 1000
}
],[
1,{
"fee": 500000
],
[
1,
{
"fee": 50
}
],[
2,{
],
[
2,
{
"fee": 0
}
],[
3,{
"fee": 2000000
],
[
3,
{
"fee": 200
}
],[
4,{}
],[
5,{
"basic_fee": 500000,
"premium_fee": 200000000,
"price_per_kbyte": 100000
],
[
4,
{}
],
[
5,
{
"basic_fee": 500,
"premium_fee": 2000,
"price_per_kbyte": 100
}
],[
6,{
"fee": 2000000,
"price_per_kbyte": 100000
],
[
6,
{
"fee": 200,
"price_per_kbyte": 100
}
],[
7,{
"fee": 300000
],
[
7,
{
"fee": 300
}
],[
8,{
"membership_annual_fee": 200000000,
"membership_lifetime_fee": 1000000000
],
[
8,
{
"membership_annual_fee": 20000,
"membership_lifetime_fee": 10000
}
],[
9,{
"fee": 50000000
],
[
9,
{
"fee": 5000
}
],[
10,{
"symbol3": "50000000000",
"symbol4": "30000000000",
"long_symbol": 500000000,
],
[
10,
{
"symbol3": "5000000",
"symbol4": "3000000",
"long_symbol": 5000,
"price_per_kbyte": 10
}
],[
11,{
"fee": 50000000,
],
[
11,
{
"fee": 5000,
"price_per_kbyte": 10
}
],[
12,{
"fee": 50000000
],
[
12,
{
"fee": 5000
}
],[
13,{
"fee": 50000000
],
[
13,
{
"fee": 5000
}
],[
14,{
"fee": 2000000,
"price_per_kbyte": 100000
],
[
14,
{
"fee": 200,
"price_per_kbyte": 100
}
],[
15,{
"fee": 2000000
],
[
15,
{
"fee": 200
}
],[
16,{
"fee": 100000
],
[
16,
{
"fee": 100
}
],[
17,{
"fee": 10000000
],
[
17,
{
"fee": 100
}
],[
18,{
"fee": 50000000
],
[
18,
{
"fee": 5000
}
],[
19,{
"fee": 100000
],
[
19,
{
"fee": 100
}
],[
20,{
"fee": 500000000
],
[
20,
{
"fee": 5000
}
],[
21,{
"fee": 2000000
],
[
21,
{
"fee": 200
}
],[
22,{
"fee": 2000000,
],
[
22,
{
"fee": 200,
"price_per_kbyte": 10
}
],[
23,{
"fee": 2000000,
],
[
23,
{
"fee": 200,
"price_per_kbyte": 10
}
],[
24,{
"fee": 100000
],
[
24,
{
"fee": 100
}
],[
25,{
"fee": 100000
],
[
25,
{
"fee": 100
}
],[
26,{
"fee": 100000
],
[
26,
{
"fee": 100
}
],[
27,{
"fee": 2000000,
],
[
27,
{
"fee": 200,
"price_per_kbyte": 10
}
],[
28,{
],
[
28,
{
"fee": 0
}
],[
29,{
"fee": 500000000
],
[
29,
{
"fee": 5000
}
],[
30,{
"fee": 2000000
],
[
30,
{
"fee": 200
}
],[
31,{
"fee": 100000
],
[
31,
{
"fee": 100
}
],[
32,{
"fee": 100000
],
[
32,
{
"fee": 100
}
],[
33,{
"fee": 2000000
],
[
33,
{
"fee": 200
}
],[
34,{
"fee": 500000000
],
[
34,
{
"fee": 5000
}
],[
35,{
"fee": 100000,
],
[
35,
{
"fee": 100,
"price_per_kbyte": 10
}
],[
36,{
"fee": 100000
],
[
36,
{
"fee": 100
}
],[
37,{}
],[
38,{
"fee": 2000000,
],
[
37,
{}
],
[
38,
{
"fee": 200,
"price_per_kbyte": 10
}
],[
39,{
"fee": 500000,
"price_per_output": 500000
],
[
39,
{
"fee": 500,
"price_per_output": 500
}
],[
40,{
"fee": 500000,
"price_per_output": 500000
],
[
40,
{
"fee": 500,
"price_per_output": 500
}
],[
41,{
"fee": 500000
],
[
41,
{
"fee": 500
}
],[
42,{}
],[
43,{
"fee": 2000000
],
[
42,
{}
],
[
43,
{
"fee": 200
}
],[
44,{}
],[
45,{
"fee": 50000000
],
[
44,
{}
],
[
45,
{
"fee": 100
}
],[
46,{
],
[
46,
{
"fee": 100
}
],
[
47,
{
"fee": 100
}
],
[
48,
{
"fee": 500
}
],
[
49,
{
"distribution_base_fee": 0,
"distribution_fee_per_holder": 0
}
],[
47,{
"fee": 100000
}
],[
48,{
"fee": 51000000
}
],[
49,{}
],
[
50,
{}
]
],
"scale": 10
"scale": 10000
},
"block_interval": 3,
"maintenance_interval": 3600,
"maintenance_skip_slots": 2,
"committee_proposal_review_period": 3600,
"block_interval": 5,
"maintenance_interval": 86400,
"maintenance_skip_slots": 3,
"committee_proposal_review_period": 1209600,
"maximum_transaction_size": 2048,
"maximum_block_size": 2048000000,
"maximum_time_until_expiration": 86400,
@ -227,7 +333,7 @@
"maximum_asset_feed_publishers": 10,
"maximum_witness_count": 1001,
"maximum_committee_count": 1001,
"maximum_authority_membership": 20,
"maximum_authority_membership": 10,
"reserve_percent_of_fee": 2000,
"network_percent_of_fee": 2000,
"lifetime_referrer_percent_of_fee": 3000,
@ -248,247 +354,222 @@
"max_time_per_commit_move": 600,
"min_time_per_reveal_move": 0,
"max_time_per_reveal_move": 600,
"rake_fee_percentage": 300,
"maximum_registration_deadline": 2592000,
"extensions": []
},
"initial_bts_accounts": [{
"name": "auction-crowdfund-reserve",
"owner_authority": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [[
"TEST67BZEhgZ9B483yokBszkA83NedJgUrFzhJXzGsTizKkUtoyxi6",
1
]
],
"address_auths": []
},
"active_authority": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [[
"TEST67BZEhgZ9B483yokBszkA83NedJgUrFzhJXzGsTizKkUtoyxi6",
1
]
],
"address_auths": []
},
"core_balance": 50000000000
},{
"name": "presale-reserve",
"owner_authority": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [[
"TEST8jS7B7pKHXaXnToP2nEdJ4pvj7fSuF88Ae17Ta3v8uuiTX9RmJ",
1
]
],
"address_auths": []
},
"active_authority": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [[
"TEST8jS7B7pKHXaXnToP2nEdJ4pvj7fSuF88Ae17Ta3v8uuiTX9RmJ",
1
]
],
"address_auths": []
},
"core_balance": 20000000000
},{
"name": "partnerships-reserve",
"owner_authority": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [[
"TEST6zCacbW4pWV6dTmDYTy164BCiZZZWVVQYuzw8JEgYbZ1MKcmD3",
1
]
],
"address_auths": []
},
"active_authority": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [[
"TEST6zCacbW4pWV6dTmDYTy164BCiZZZWVVQYuzw8JEgYbZ1MKcmD3",
1
]
],
"address_auths": []
},
"core_balance": 10000000000
},{
"name": "development-reserve",
"owner_authority": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [[
"TEST5brW8vLLLKMjyshBTUQdq1gdz3FWg7wgeLxcxyPHt6eqEWRhfh",
1
]
],
"address_auths": []
},
"active_authority": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [[
"TEST5brW8vLLLKMjyshBTUQdq1gdz3FWg7wgeLxcxyPHt6eqEWRhfh",
1
]
],
"address_auths": []
},
"core_balance": 10000000000
},{
"name": "bts-sharedrop",
"owner_authority": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [[
"TEST8fePLMjBQ2a9o6U9G4cPpLvJwJNrfaziKjEPNmecidcGuxgWAV",
1
]
],
"address_auths": []
},
"active_authority": {
"weight_threshold": 1,
"account_auths": [],
"key_auths": [[
"TEST8fePLMjBQ2a9o6U9G4cPpLvJwJNrfaziKjEPNmecidcGuxgWAV",
1
]
],
"address_auths": []
},
"core_balance": 5000000000
}
],
"initial_accounts": [{
"initial_bts_accounts": [],
"initial_accounts": [
{
"name": "init0",
"owner_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"active_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"owner_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"active_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"is_lifetime_member": true
},{
},
{
"name": "init1",
"owner_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"active_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"owner_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"active_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"is_lifetime_member": true
},{
},
{
"name": "init2",
"owner_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"active_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"owner_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"active_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"is_lifetime_member": true
},{
},
{
"name": "init3",
"owner_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"active_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"owner_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"active_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"is_lifetime_member": true
},{
},
{
"name": "init4",
"owner_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"active_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"owner_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"active_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"is_lifetime_member": true
},{
},
{
"name": "init5",
"owner_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"active_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"owner_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"active_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"is_lifetime_member": true
},{
},
{
"name": "init6",
"owner_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"active_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"owner_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"active_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"is_lifetime_member": true
},{
},
{
"name": "init7",
"owner_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"active_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"owner_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"active_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"is_lifetime_member": true
},{
},
{
"name": "init8",
"owner_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"active_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"owner_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"active_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"is_lifetime_member": true
},{
},
{
"name": "init9",
"owner_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"active_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"owner_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"active_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"is_lifetime_member": true
},{
},
{
"name": "init10",
"owner_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"active_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM",
"owner_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"active_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"is_lifetime_member": true
},
{
"name": "nathan",
"owner_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"active_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"is_lifetime_member": true
},
{
"name": "pixel-gateway",
"owner_key": "TEST8dkWexMv9Z7fwoCdfKZfqpBUFB77D1PzfPBU2hHwMpN9B5t6wZ",
"active_key": "TEST8dkWexMv9Z7fwoCdfKZfqpBUFB77D1PzfPBU2hHwMpN9B5t6wZ",
"is_lifetime_member": true
}
],
"initial_assets": [],
"initial_balances": [{
"initial_assets": [
{
"accumulated_fees": 0,
"collateral_records": [
{
"collateral": -1,
"debt": 100000000000000,
"owner": "TEST6eTLvHVD1Qg5rUoEnKgTvpXaW2p7xHyce"
}
],
"description": "1 bitcoin",
"is_bitasset": true,
"issuer_name": "pixel-gateway",
"max_supply": "10000000000000000",
"precision": 3,
"symbol": "PIXEL.BITCOIN"
},
{
"accumulated_fees": 0,
"collateral_records": [
{
"collateral": -1,
"debt": 100000000000000,
"owner": "TEST6eTLvHVD1Qg5rUoEnKgTvpXaW2p7xHyce"
}
],
"description": "1 steem",
"is_bitasset": true,
"issuer_name": "pixel-gateway",
"max_supply": "10000000000000000",
"precision": 3,
"symbol": "PIXEL.STEEM"
}
],
"initial_balances": [
{
"owner": "TESTFAbAx7yuxt725qSZvfwWqkdCwp9ZnUama",
"asset_symbol": "TEST",
"asset_symbol": "TESTPLAYS",
"amount": "1000000000000000"
},
{
"owner": "TEST6eTLvHVD1Qg5rUoEnKgTvpXaW2p7xHyce",
"asset_symbol": "PIXEL.BITCOIN",
"amount": "1000000000000000"
},
{
"owner": "TEST6eTLvHVD1Qg5rUoEnKgTvpXaW2p7xHyce",
"asset_symbol": "PIXEL.STEEM",
"amount": "1000000000000000"
}
],
"initial_vesting_balances": [],
"initial_active_witnesses": 11,
"initial_witness_candidates": [{
"initial_witness_candidates": [
{
"owner_name": "init0",
"block_signing_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM"
},{
"block_signing_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
},
{
"owner_name": "init1",
"block_signing_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM"
},{
"block_signing_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
},
{
"owner_name": "init2",
"block_signing_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM"
},{
"block_signing_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
},
{
"owner_name": "init3",
"block_signing_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM"
},{
"block_signing_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
},
{
"owner_name": "init4",
"block_signing_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM"
},{
"block_signing_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
},
{
"owner_name": "init5",
"block_signing_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM"
},{
"block_signing_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
},
{
"owner_name": "init6",
"block_signing_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM"
},{
"block_signing_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
},
{
"owner_name": "init7",
"block_signing_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM"
},{
"block_signing_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
},
{
"owner_name": "init8",
"block_signing_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM"
},{
"block_signing_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
},
{
"owner_name": "init9",
"block_signing_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM"
},{
"block_signing_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
},
{
"owner_name": "init10",
"block_signing_key": "TEST5UbPsMhANF7jW1aYxTV546gJeNSGNiWJqmBuYmoSxPqRF9mpXM"
"block_signing_key": "TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
}
],
"initial_committee_candidates": [{
"initial_committee_candidates": [
{
"owner_name": "init0"
},{
},
{
"owner_name": "init1"
},{
},
{
"owner_name": "init2"
},{
},
{
"owner_name": "init3"
},{
},
{
"owner_name": "init4"
},{
},
{
"owner_name": "init5"
},{
},
{
"owner_name": "init6"
},{
},
{
"owner_name": "init7"
},{
},
{
"owner_name": "init8"
},{
},
{
"owner_name": "init9"
},{
},
{
"owner_name": "init10"
}
],

View file

@ -143,6 +143,8 @@ class database_api_impl : public std::enable_shared_from_this<database_api_impl>
// Tournaments
vector<tournament_object> get_tournaments_in_state(tournament_state state, uint32_t limit) const;
vector<tournament_object> get_tournaments(tournament_id_type stop, unsigned limit, tournament_id_type start);
vector<tournament_object> get_tournaments_by_state(tournament_id_type stop, unsigned limit, tournament_id_type start, tournament_state state);
vector<tournament_id_type> get_registered_tournaments(account_id_type account_filter, uint32_t limit) const;
@ -1788,6 +1790,54 @@ vector<tournament_object> database_api_impl::get_tournaments_in_state(tournament
return result;
}
vector<tournament_object> database_api::get_tournaments(tournament_id_type stop,
unsigned limit,
tournament_id_type start)
{
return my->get_tournaments(stop, limit, start);
}
vector<tournament_object> database_api_impl::get_tournaments(tournament_id_type stop,
unsigned limit,
tournament_id_type start)
{
vector<tournament_object> result;
const auto& tournament_idx = _db.get_index_type<tournament_index>().indices().get<by_id>();
for (auto elem: tournament_idx) {
if( ( (elem.get_id().instance.value <= start.instance.value) || start == tournament_id_type()) &&
( (elem.get_id().instance.value >= stop.instance.value) || stop == tournament_id_type()))
result.push_back( elem );
}
return result;
}
vector<tournament_object> database_api::get_tournaments_by_state(tournament_id_type stop,
unsigned limit,
tournament_id_type start,
tournament_state state)
{
return my->get_tournaments_by_state(stop, limit, start, state);
}
vector<tournament_object> database_api_impl::get_tournaments_by_state(tournament_id_type stop,
unsigned limit,
tournament_id_type start,
tournament_state state)
{
vector<tournament_object> result;
const auto& tournament_idx = _db.get_index_type<tournament_index>().indices().get<by_id>();
for (auto elem: tournament_idx) {
if( ( (elem.get_id().instance.value <= start.instance.value) || start == tournament_id_type()) &&
( (elem.get_id().instance.value >= stop.instance.value) || stop == tournament_id_type()) &&
elem.get_state() == state )
result.push_back( elem );
}
return result;
}
vector<tournament_id_type> database_api::get_registered_tournaments(account_id_type account_filter, uint32_t limit) const
{
return my->get_registered_tournaments(account_filter, limit);

View file

@ -564,6 +564,15 @@ class database_api
*/
vector<tournament_object> get_tournaments_in_state(tournament_state state, uint32_t limit) const;
vector<tournament_object> get_tournaments(tournament_id_type stop = tournament_id_type(),
unsigned limit = 100,
tournament_id_type start = tournament_id_type());
vector<tournament_object> get_tournaments_by_state(tournament_id_type stop = tournament_id_type(),
unsigned limit = 100,
tournament_id_type start = tournament_id_type(),
tournament_state state = tournament_state::accepting_registrations);
/**
* @return the list of tournaments that a given account is registered to play in
*/
@ -674,5 +683,7 @@ FC_API(graphene::app::database_api,
// Tournaments
(get_tournaments_in_state)
(get_tournaments_by_state)
(get_tournaments )
(get_registered_tournaments)
)

View file

@ -23,7 +23,7 @@
*/
#pragma once
#define GRAPHENE_SYMBOL "TEST"
#define GRAPHENE_SYMBOL "TESTPLAYS"
#define GRAPHENE_ADDRESS_PREFIX "TEST"
#define GRAPHENE_MIN_ACCOUNT_NAME_LENGTH 1

View file

@ -64,6 +64,7 @@ namespace graphene { namespace chain {
~tournament_object();
tournament_object& operator=(const tournament_object& rhs);
tournament_id_type get_id() const { return id; };
/// the account that created this tournament
account_id_type creator;

View file

@ -1502,6 +1502,15 @@ class wallet_api
*/
vector<tournament_object> get_upcoming_tournaments(uint32_t limit);
vector<tournament_object> get_tournaments(tournament_id_type stop,
unsigned limit,
tournament_id_type start);
vector<tournament_object> get_tournaments_by_state(tournament_id_type stop,
unsigned limit,
tournament_id_type start,
tournament_state state);
/** Get specific information about a tournament
* @param tournament_id the ID of the tournament
*/
@ -1723,6 +1732,8 @@ FC_API( graphene::wallet::wallet_api,
(tournament_join)
(rps_throw)
(get_upcoming_tournaments)
(get_tournaments)
(get_tournaments_by_state)
(get_tournament)
(get_order_book)
)

View file

@ -2466,7 +2466,7 @@ public:
}
return ss.str();
};
m["get_upcoming_tournaments"] = [this](variant result, const fc::variants& a)
m["get_upcoming_tournaments"] = m["get_tournaments"] = m["get_tournaments_by_state"] = [this](variant result, const fc::variants& a)
{
const vector<tournament_object> tournaments = result.as<vector<tournament_object> >();
std::stringstream ss;
@ -4857,6 +4857,18 @@ vector<tournament_object> wallet_api::get_upcoming_tournaments(uint32_t limit)
{
return my->_remote_db->get_tournaments_in_state(tournament_state::accepting_registrations, limit);
}
vector<tournament_object> wallet_api::get_tournaments(tournament_id_type stop,
unsigned limit,
tournament_id_type start) {
return my->_remote_db->get_tournaments(stop, limit, start);
}
vector<tournament_object> wallet_api::get_tournaments_by_state(tournament_id_type stop,
unsigned limit,
tournament_id_type start,
tournament_state state) {
return my->_remote_db->get_tournaments_by_state(stop, limit, start, state);
}
tournament_object wallet_api::get_tournament(tournament_id_type id)
{