This commit is contained in:
Vyacheslav Anzhiganov 2017-12-25 14:53:54 +03:00
parent 2688960be3
commit 9237ad9793
2 changed files with 47 additions and 74 deletions

View file

@ -8,10 +8,20 @@
<div class="mui-row">
<div class="mui-col-md-12" style="background-color: red; color: white;">
<h1>Недостаточно денег в кошельке.</h1>
<h2>Необходимо пополнить кошелёк для участия в турнире.</h2>
<h2>Необходимо пополнить кошелёк на 100 рублей для участия в турнире.</h2>
</div>
</div>
{% else %}
{% set allow_apply = 'true' %}
{% for u in rush_list_accounts %}
{% if u.account_id|int == account_id|int %}
{% set allow_apply = 'false' %}
{% endif %}
{% endfor %}
{% if allow_apply == 'true' %}
<div class="mui-row">
<div class="mui-col-md-12" style="background-color: green; color: white;">
<table class="mui-table mui-table--bordered" >
<thead>
<tr>
@ -34,20 +44,22 @@
{% endif %}
{% endfor %}
</table>
<div>
<h3>Участники</h3>
{% set allow_apply = 'true' %}
<a href="{{ url_for('pages_rush.apply') }}" class="mui-btn mui-btn--primary mui-btn--raised">Участвовать</a>
</div>
</div>
{% else %}
<div class="mui-row">
<div class="mui-col-md-12" style="background-color: black; color: white;">
<h3>Вы участвуете, вам необходимо совершить максимальное кол-во побед за время турнира</h3>
<h4>Участники</h4>
{% for u in rush_list_accounts %}
{% if u.account_id|int == account_id|int %}
{% set allow_apply = 'false' %}
{{ u.account_id }}
{% endif %}
{% endfor %}
</div>
{% if allow_apply == 'true' %}
<a href="{{ url_for('pages_rush.apply') }}" class="mui-btn mui-btn--primary mui-btn--raised">Участвовать</a>
{% else %}
<h3>Вы участвуете, вам необходимо совершить максимальное кол-во побед за время турнира</h3>
</div>
{% endif %}
{% endif %}

View file

@ -33,45 +33,6 @@ def index():
ub = UserWallet.query.filter(UserWallet.user == session['user']).first()
# #
# app_id = current_app.config['WG_APPLICATION_ID']
# url = 'https://api.worldoftanks.ru/wot/account/info/'
# __ = requests.get('{}?application_id={}&account_id={}'.format(url, app_id, account_id)).json()
# # if not __.get('data', {}).get("{}".format(account_id)):
# # print('account_id: {} SKIPPED'.format(account_id))
# # continue
# # copy results
# account_statistics = __.get('data', {}).get("{}".format(account_id)).get('statistics', {})
# account_data = __['data']["{}".format(account_id)]['statistics']['all']
#
# data = {
# 'battles': account_data['battles'],
# 'wins': account_data['wins'],
# 'losses': account_data['losses'],
# 'draws': account_data['draws'],
# }
# account_data.pop('statistics', None)
# db.session.add(WotAccounts(account_id=account_id, nickname=account_data.get('nickname')))
# db.session.commit()
# db.session.flush()
# ws = WotAccountsStats()
# ws.account_id = account_id
# ws.created_at = datetime.now()
# try:
# ws.last_battle_time = datetime.fromtimestamp(int(account_data.get('last_battle_time'))).strftime('%Y-%m-%d %H:%M:%S')
# except Exception as e:
# print('>> Error: {}'.format(e))
# ws.data = account_data
# ws.statistics = account_statistics
# db.session.add(ws)
# db.session.commit()
# db.session.flush()
return render_template(
'pages/rush/index.html',
rush_list=rush_list,