upd
This commit is contained in:
parent
4d68d3d457
commit
2688960be3
5 changed files with 135 additions and 81 deletions
13
README.md
13
README.md
|
@ -13,10 +13,7 @@ For Postgres installation
|
|||
|
||||
https://developer.fedoraproject.org/tech/database/postgresql/about.html
|
||||
|
||||
|
||||
```
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
pip install -r requirements.txt
|
||||
|
||||
## Upgrade
|
||||
|
||||
|
@ -28,15 +25,11 @@ Upgrade database
|
|||
|
||||
Application
|
||||
|
||||
```
|
||||
python run_app.py
|
||||
```
|
||||
python run_app.py
|
||||
|
||||
Celery Worker
|
||||
|
||||
```
|
||||
celery worker -A run_celery.celery -l info
|
||||
```
|
||||
celery worker -A run_celery.celery -l info
|
||||
|
||||
Celery Beat
|
||||
|
||||
|
|
95
wotstats/templates/pages/rush/history.html
Normal file
95
wotstats/templates/pages/rush/history.html
Normal file
|
@ -0,0 +1,95 @@
|
|||
{% extends 'layouts/main.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Турниры</h2>
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-12">
|
||||
<table class="mui-table mui-table--bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Старт</th>
|
||||
<th>Финиш</th>
|
||||
<th>Ставка</th>
|
||||
<th>Статус</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for r in rush_list %}
|
||||
{% if r.status == "preparation" %}
|
||||
<tr>
|
||||
<td>{{ r.id }}</td>
|
||||
<td>{{ r.at_start }}</td>
|
||||
<td>{{ r.at_finish }}</td>
|
||||
<td>{{ r.bet }} рублей</td>
|
||||
<td>{{ r.status }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
<div>
|
||||
<h3>Участники</h3>
|
||||
{% set allow_apply = 'true' %}
|
||||
{% 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>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="mui-col-md-12">
|
||||
<h3>Текущий</h3>
|
||||
<table class="mui-table mui-table--bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Старт</th>
|
||||
<th>Финиш</th>
|
||||
<th>Ставка</th>
|
||||
<th>Статус</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for r in rush_list %}
|
||||
{% if r.status == "started" %}
|
||||
<tr>
|
||||
<td>{{ r.id }}</td>
|
||||
<td>{{ r.at_start }}</td>
|
||||
<td>{{ r.at_finish }}</td>
|
||||
<td>{{ r.bet }} рублей</td>
|
||||
<td>{{ r.status }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
<h3>Завершены</h3>
|
||||
<table class="mui-table mui-table--bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Старт</th>
|
||||
<th>Финиш</th>
|
||||
<th>Ставка</th>
|
||||
<th>Статус</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for r in rush_list %}
|
||||
{% if r.status in ["finished", "canceled"] %}
|
||||
<tr>
|
||||
<td>{{ r.id }}</td>
|
||||
<td>{{ r.at_start }}</td>
|
||||
<td>{{ r.at_finish }}</td>
|
||||
<td>{{ r.bet }} рублей</td>
|
||||
<td>{{ r.status }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -4,70 +4,15 @@
|
|||
<h2>Турниры</h2>
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-12">
|
||||
<table class="mui-table mui-table--bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Старт</th>
|
||||
<th>Финиш</th>
|
||||
<th>Ставка</th>
|
||||
<th>Статус</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for r in rush_list %}
|
||||
{% if r.status == "preparation" %}
|
||||
<tr>
|
||||
<td>{{ r.id }}</td>
|
||||
<td>{{ r.at_start }}</td>
|
||||
<td>{{ r.at_finish }}</td>
|
||||
<td>{{ r.bet }} рублей</td>
|
||||
<td>{{ r.status }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
<div>
|
||||
<h3>Участники</h3>
|
||||
{% set allow_apply = 'true' %}
|
||||
{% 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>
|
||||
{% if account_balance < 100 %}
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-12" style="background-color: red; color: white;">
|
||||
<h1>Недостаточно денег в кошельке.</h1>
|
||||
<h2>Необходимо пополнить кошелёк для участия в турнире.</h2>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<h3>Вы участвуете, вам необходимо совершить максимальное кол-во побед за время турнира</h3>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="mui-col-md-12">
|
||||
<h3>Текущий</h3>
|
||||
<table class="mui-table mui-table--bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Старт</th>
|
||||
<th>Финиш</th>
|
||||
<th>Ставка</th>
|
||||
<th>Статус</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for r in rush_list %}
|
||||
{% if r.status == "started" %}
|
||||
<tr>
|
||||
<td>{{ r.id }}</td>
|
||||
<td>{{ r.at_start }}</td>
|
||||
<td>{{ r.at_finish }}</td>
|
||||
<td>{{ r.bet }} рублей</td>
|
||||
<td>{{ r.status }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
<h3>Завершены</h3>
|
||||
<table class="mui-table mui-table--bordered">
|
||||
<table class="mui-table mui-table--bordered" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
|
@ -78,7 +23,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
{% for r in rush_list %}
|
||||
{% if r.status in ["finished", "canceled"] %}
|
||||
{% if r.status == "preparation" %}
|
||||
<tr>
|
||||
<td>{{ r.id }}</td>
|
||||
<td>{{ r.at_start }}</td>
|
||||
|
@ -89,6 +34,24 @@
|
|||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
<div>
|
||||
<h3>Участники</h3>
|
||||
{% set allow_apply = 'true' %}
|
||||
{% 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>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -43,9 +43,6 @@ def login():
|
|||
@pages_home.route('/login', methods=['POST'])
|
||||
@oid.loginhandler
|
||||
def login_post():
|
||||
print request.form
|
||||
print request.args
|
||||
|
||||
if g.user is not None:
|
||||
return redirect(oid.get_next_url())
|
||||
|
||||
|
@ -104,8 +101,8 @@ def token():
|
|||
print request.form
|
||||
print session
|
||||
|
||||
#if 'openid' not in session or 'user' in session:
|
||||
# return redirect(url_for('pages_home.index'))
|
||||
# if 'openid' not in session or 'user' in session:
|
||||
# return redirect(url_for('pages_home.index'))
|
||||
|
||||
# ImmutableMultiDict([('status', u'ok'), ('access_token', u'a4d0a13df7c733102fbf6cd650794c6d047e91aa'), ('nickname', u'CrazyPants1999'), ('account_id', u'69552613'), ('', u'1505047809')])
|
||||
if request.args.get('status') == 'ok' and request.args.get('access_token'):
|
||||
|
|
|
@ -7,7 +7,7 @@ from jinja2 import TemplateNotFound
|
|||
from wotstats.openid import oid
|
||||
|
||||
from wotstats.database import db
|
||||
from wotstats.models import Rush, RushAccounts, WotAccounts
|
||||
from wotstats.models import Rush, RushAccounts, WotAccounts, UserWallet
|
||||
from wotstats.lib import parse_wargaming_openid_url
|
||||
|
||||
pages_rush = Blueprint(
|
||||
|
@ -29,6 +29,10 @@ def index():
|
|||
|
||||
account_id, account_nickname = parse_wargaming_openid_url(session['openid'])
|
||||
|
||||
print(session)
|
||||
|
||||
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/'
|
||||
|
@ -72,7 +76,9 @@ def index():
|
|||
'pages/rush/index.html',
|
||||
rush_list=rush_list,
|
||||
rush_list_accounts=rush_list_accounts,
|
||||
account_id=account_id, account_nickname=account_nickname
|
||||
account_id=account_id,
|
||||
account_nickname=account_nickname,
|
||||
account_balance=ub.balance
|
||||
)
|
||||
|
||||
@pages_rush.route('/apply.html')
|
||||
|
|
Reference in a new issue