Compare commits
10 commits
d7b33085ff
...
1a0040626f
Author | SHA1 | Date | |
---|---|---|---|
1a0040626f | |||
![]() |
acc2547aa0 | ||
![]() |
e8d1b13245 | ||
![]() |
726a2de927 | ||
d6334bde4e | |||
9237ad9793 | |||
![]() |
2688960be3 | ||
![]() |
4d68d3d457 | ||
![]() |
cfb7258d24 | ||
![]() |
4dcf7d63c3 |
23 changed files with 9374 additions and 633 deletions
13
README.md
13
README.md
|
@ -13,10 +13,7 @@ For Postgres installation
|
||||||
|
|
||||||
https://developer.fedoraproject.org/tech/database/postgresql/about.html
|
https://developer.fedoraproject.org/tech/database/postgresql/about.html
|
||||||
|
|
||||||
|
pip install -r requirements.txt
|
||||||
```
|
|
||||||
pip install -r requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
## Upgrade
|
## Upgrade
|
||||||
|
|
||||||
|
@ -28,15 +25,11 @@ Upgrade database
|
||||||
|
|
||||||
Application
|
Application
|
||||||
|
|
||||||
```
|
python run_app.py
|
||||||
python run_app.py
|
|
||||||
```
|
|
||||||
|
|
||||||
Celery Worker
|
Celery Worker
|
||||||
|
|
||||||
```
|
celery worker -A run_celery.celery -l info
|
||||||
celery worker -A run_celery.celery -l info
|
|
||||||
```
|
|
||||||
|
|
||||||
Celery Beat
|
Celery Beat
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ SQLALCHEMY_DATABASE_URI="postgres://wot:wot@192.168.1.47/wot"
|
||||||
OPENID_FS_STORE_PATH="tmp"
|
OPENID_FS_STORE_PATH="tmp"
|
||||||
|
|
||||||
WG_REDIRECT_URL="http://wot.anzhiganov.com/token"
|
WG_REDIRECT_URL="http://wot.anzhiganov.com/token"
|
||||||
|
#WG_REDIRECT_URL="http://localhost:5000/token"
|
||||||
WG_APPLICATION_ID="502910c1c785c3c7ca2e83c9e89bde02"
|
WG_APPLICATION_ID="502910c1c785c3c7ca2e83c9e89bde02"
|
||||||
# WG_OPENID_URL=https://eu.wargaming.net/id/openid/
|
# WG_OPENID_URL=https://eu.wargaming.net/id/openid/
|
||||||
WG_OPENID_URL="https://wargaming.net/id/openid/"
|
WG_OPENID_URL="https://wargaming.net/id/openid/"
|
||||||
|
|
2337
wotstats/static/css/font-awesome.css
vendored
Normal file
2337
wotstats/static/css/font-awesome.css
vendored
Normal file
File diff suppressed because it is too large
Load diff
4
wotstats/static/css/font-awesome.min.css
vendored
Normal file
4
wotstats/static/css/font-awesome.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
wotstats/static/fonts/FontAwesome.otf
Normal file
BIN
wotstats/static/fonts/FontAwesome.otf
Normal file
Binary file not shown.
BIN
wotstats/static/fonts/fontawesome-webfont.eot
Normal file
BIN
wotstats/static/fonts/fontawesome-webfont.eot
Normal file
Binary file not shown.
2671
wotstats/static/fonts/fontawesome-webfont.svg
Normal file
2671
wotstats/static/fonts/fontawesome-webfont.svg
Normal file
File diff suppressed because it is too large
Load diff
After Width: | Height: | Size: 434 KiB |
BIN
wotstats/static/fonts/fontawesome-webfont.ttf
Normal file
BIN
wotstats/static/fonts/fontawesome-webfont.ttf
Normal file
Binary file not shown.
BIN
wotstats/static/fonts/fontawesome-webfont.woff
Normal file
BIN
wotstats/static/fonts/fontawesome-webfont.woff
Normal file
Binary file not shown.
BIN
wotstats/static/fonts/fontawesome-webfont.woff2
Normal file
BIN
wotstats/static/fonts/fontawesome-webfont.woff2
Normal file
Binary file not shown.
4
wotstats/static/js/jquery-latest.min.js
vendored
Normal file
4
wotstats/static/js/jquery-latest.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -7,6 +7,7 @@
|
||||||
<!-- load MUI -->
|
<!-- load MUI -->
|
||||||
<link href="//cdn.muicss.com/mui-0.9.22/css/mui.min.css" rel="stylesheet" type="text/css" />
|
<link href="//cdn.muicss.com/mui-0.9.22/css/mui.min.css" rel="stylesheet" type="text/css" />
|
||||||
<script src="//cdn.muicss.com/mui-0.9.22/js/mui.min.js"></script>
|
<script src="//cdn.muicss.com/mui-0.9.22/js/mui.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="/static/css/font-awesome.min.css">
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: #f0f0f0;
|
background-color: #f0f0f0;
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
{% extends 'layouts/main.html' %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<h2>My Statistics</h2>
|
|
||||||
<ul>
|
|
||||||
{% for z in account_statistics %}
|
|
||||||
<li>{{ z }}
|
|
||||||
{% if account_statistics[z] is mapping %}
|
|
||||||
<ul>
|
|
||||||
{% for x in account_statistics[z] %}
|
|
||||||
<li>{{ x }}
|
|
||||||
{% if account_statistics[z][x] is mapping %}
|
|
||||||
<ul>
|
|
||||||
{% for c in account_statistics[z][x] %}
|
|
||||||
<li>{{ c }}: {{ account_statistics[z][x][c] }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% else %}
|
|
||||||
<ul>
|
|
||||||
<li>{{ x }}: {{ account_statistics[z][x] }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endif %}
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% else %}
|
|
||||||
{{ account_statistics[z] }}
|
|
||||||
{% endif %}
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
|
@ -1,128 +1,168 @@
|
||||||
{% extends 'layouts/main.html' %}
|
{% extends 'layouts/main.html' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<style>
|
||||||
|
.not_sorted {
|
||||||
|
color: #f0f0f0;
|
||||||
|
}
|
||||||
|
.sorted {
|
||||||
|
color: #000000;
|
||||||
|
};
|
||||||
|
</style>
|
||||||
<h2>Техника</h2>
|
<h2>Техника</h2>
|
||||||
Категории
|
Категории
|
||||||
<input type="checkbox" name="checkall" id="checkall" value="1"> Все
|
<!-- <input type="checkbox" name="checkall" id="checkall" value="1"> Все -->
|
||||||
<input type="checkbox" name="cat[1]" value="1"> I
|
<input type="checkbox" name="level" class="level" value="1" {% if 1 in args.level %}checked{% endif %}> I
|
||||||
<input type="checkbox" name="cat[2]" value="2"> II
|
<input type="checkbox" name="level" class="level" value="2" {% if 2 in args.level %}checked{% endif %}> II
|
||||||
<input type="checkbox" name="cat[3]" value="3"> III
|
<input type="checkbox" name="level" class="level" value="3" {% if 3 in args.level %}checked{% endif %}> III
|
||||||
<input type="checkbox" name="cat[4]" value="4"> IV
|
<input type="checkbox" name="level" class="level" value="4" {% if 4 in args.level %}checked{% endif %}> IV
|
||||||
<input type="checkbox" name="cat[5]" value="5"> V
|
<input type="checkbox" name="level" class="level" value="5" {% if 5 in args.level %}checked{% endif %}> V
|
||||||
<input type="checkbox" name="cat[6]" value="6"> VI
|
<input type="checkbox" name="level" class="level" value="6" {% if 6 in args.level %}checked{% endif %}> VI
|
||||||
<input type="checkbox" name="cat[7]" value="7"> VII
|
<input type="checkbox" name="level" class="level" value="7" {% if 7 in args.level %}checked{% endif %}> VII
|
||||||
<input type="checkbox" name="cat[8]" value="8"> VIII
|
<input type="checkbox" name="level" class="level" value="8" {% if 8 in args.level %}checked{% endif %}> VIII
|
||||||
<input type="checkbox" name="cat[9]" value="9"> IX
|
<input type="checkbox" name="level" class="level" value="9" {% if 9 in args.level %}checked{% endif %}> IX
|
||||||
<input type="checkbox" name="cat[10]" value="10"> X
|
<input type="checkbox" name="level" class="level" value="10" {% if 10 in args.level %}checked{% endif %}> X
|
||||||
|
|
||||||
|
<table id="myTable" class="mui-table mui-table--bordered tablesorter">
|
||||||
<table id="myTable" class="mui-table mui-table--bordered tablesorter">
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<th>Нация</th>
|
<th>Нация</th>
|
||||||
<th>Уровень</th>
|
<th onclick="$(this).order_sort('level', '{% if not args.sort %}desc{% else %}asc{% endif %}')">
|
||||||
<th>Тип</th>
|
Уровень
|
||||||
<th>Название</th>
|
{% if args.order == 'level' %}
|
||||||
<th>Кол-во боёв</th>
|
<i class="fa fa-sort-alpha-{% if args.sort %}desc{% else %}asc{% endif %} sorted" aria-hidden="true"></i>
|
||||||
<th>Кол-во побед</th>
|
{% else %}
|
||||||
|
<i class="fa fa-sort-alpha-{% if args.sort %}desc{% else %}asc{% endif %} not_sorted" aria-hidden="true"></i>
|
||||||
|
{% endif %}
|
||||||
|
</th>
|
||||||
|
<th onclick="$(this).order_sort('type', '{% if not args.sort %}desc{% else %}asc{% endif %}')">
|
||||||
|
Тип
|
||||||
|
{% if args.order == 'type' %}
|
||||||
|
<i class="fa fa-sort-alpha-{% if args.sort %}desc{% else %}asc{% endif %} sorted" aria-hidden="true"></i>
|
||||||
|
{% else %}
|
||||||
|
<i class="fa fa-sort-alpha-{% if args.sort %}desc{% else %}asc{% endif %} not_sorted" aria-hidden="true"></i>
|
||||||
|
{% endif %}
|
||||||
|
</th>
|
||||||
|
<th onclick="$(this).order_sort('name', '{% if not args.sort %}desc{% else %}asc{% endif %}')">
|
||||||
|
Название
|
||||||
|
{% if args.order == 'name' %}
|
||||||
|
<i class="fa fa-sort-alpha-{% if args.sort %}desc{% else %}asc{% endif %} sorted" aria-hidden="true"></i>
|
||||||
|
{% else %}
|
||||||
|
<i class="fa fa-sort-alpha-{% if args.sort %}desc{% else %}asc{% endif %} not_sorted" aria-hidden="true"></i>
|
||||||
|
{% endif %}
|
||||||
|
</th>
|
||||||
|
<th onclick="$(this).order_sort('battles', '{% if not args.sort %}desc{% else %}asc{% endif %}')">
|
||||||
|
Кол-во боёв
|
||||||
|
{% if args.order == 'battles' %}
|
||||||
|
<i class="fa fa-sort-alpha-{% if args.sort %}desc{% else %}asc{% endif %} sorted" aria-hidden="true"></i>
|
||||||
|
{% else %}
|
||||||
|
<i class="fa fa-sort-alpha-{% if args.sort %}desc{% else %}asc{% endif %} not_sorted" aria-hidden="true"></i>
|
||||||
|
{% endif %}
|
||||||
|
</th>
|
||||||
|
<th onclick="$(this).order_sort('wins', '{% if not args.sort %}desc{% else %}asc{% endif %}')">
|
||||||
|
Кол-во побед
|
||||||
|
{% if args.order == 'wins' %}
|
||||||
|
<i class="fa fa-sort-alpha-{% if args.sort %}desc{% else %}asc{% endif %} sorted" aria-hidden="true"></i>
|
||||||
|
{% else %}
|
||||||
|
<i class="fa fa-sort-alpha-{% if args.sort %}desc{% else %}asc{% endif %} not_sorted" aria-hidden="true"></i>
|
||||||
|
{% endif %}
|
||||||
|
</th>
|
||||||
|
<th> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
|
{% for x in account_technic %}
|
||||||
|
<tr>
|
||||||
|
<!-- <td>{{ x['tank_id'] }}</td> -->
|
||||||
|
<td><img src="{{ x.details.image }}" ></td>
|
||||||
|
<td>{{ x.details.nation }}</td>
|
||||||
|
<td>{{ x['details']['level'] }}</td>
|
||||||
|
<td>{{ x['details']['type'] }}</td>
|
||||||
|
<td>{{ x['details']['name'] }}</td>
|
||||||
|
<td>{{ x['statistics']['battles'] }}</td>
|
||||||
|
<td>{{ x['statistics']['wins'] }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{#
|
|
||||||
{% for x in account_technic %}
|
|
||||||
<tr>
|
|
||||||
<!-- <td>{{ x['tank_id'] }}</td> -->
|
|
||||||
<td><img src="{{ x['details']['image'] }}" ></td>
|
|
||||||
<td>{{ x['details']['nation'] }}</td>
|
|
||||||
<td>{{ x['details']['level'] }}</td>
|
|
||||||
<td>{{ x['details']['type'] }}</td>
|
|
||||||
<td>{{ x['details']['name'] }}</td>
|
|
||||||
<td>{{ x['statistics']['battles'] }}</td>
|
|
||||||
<td>{{ x['statistics']['wins'] }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
#}
|
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
|
<script src="/static/js/jquery-latest.min.js"></script>
|
||||||
<script src="/static/js/jquery.tablesorter.min.js"></script>
|
<script src="/static/js/jquery.tablesorter.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function checkall(selected) {
|
|
||||||
if (selected == 0 || selected == 10) {
|
|
||||||
$('#checkall').prop('checked', true);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
function request_seleted(selected) {
|
|
||||||
$.getJSON( "/technic/list.json", {level: selected.concat()}, function( data ) {
|
|
||||||
$('#myTable tbody').html('');
|
|
||||||
$.each( data.technic, function(key, val) {
|
|
||||||
d = val.details;
|
|
||||||
s = val.statistics;
|
|
||||||
$('#myTable tbody').append('<tr><td><img src="'+d.image+'"></td><td><img src="https://ru-wotp.wgcdn.co/static/5.7.0_023df2/wotp_static/img/core/frontend/scss/common/components/icons/img/filter-'+d.nation+'.png"> '+d.nation_i18n+'</td><td>'+d.level+'</td><td>'+d.type_i18n+'</td><td>'+d.name_i18n+'</td><td>'+s.battles+'</td><td>'+s.wins+'</td></tr>');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
var params = {
|
||||||
|
order: {% if args.order %}'{{ request.args.order }}'{% else%}'id'{% endif %},
|
||||||
|
sort: {% if args.sort %}'{{ request.args.sort }}'{% else%}'asc'{% endif %},
|
||||||
|
level: [
|
||||||
|
{% for level in args.level %}
|
||||||
|
{{ level|int }},
|
||||||
|
{% endfor %}
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
var inputs = $('input[name*=cat]');
|
console.log($.param(params));
|
||||||
|
|
||||||
var selected = [];
|
$(".level").change(function() {
|
||||||
for(var i=0; i < inputs.length; i++) {
|
console.log($(this).is(':checked'));
|
||||||
if (inputs[i].checked == true) {
|
console.log("index: " + params.level.indexOf(parseInt($(this).val())));
|
||||||
selected.push(inputs[i].value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
request_seleted(selected);
|
|
||||||
|
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
var int_level = parseInt($(this).val());
|
||||||
|
|
||||||
$('#checkall').click(function(){
|
console.log('data: + ' + int_level);
|
||||||
var checked_count = 0;
|
|
||||||
|
|
||||||
for(var i=0; i < inputs.length; i++) {
|
if (params.level.indexOf(int_level) < 0) {
|
||||||
if (inputs[i].checked == false) {
|
params.level.push(int_level);
|
||||||
checked_count += 1;
|
console.log('data index: ' + params.level.indexOf(int_level));
|
||||||
};
|
|
||||||
inputs[i].checked = $('#checkall').prop('checked');
|
|
||||||
}
|
|
||||||
checkall(checked_count);
|
|
||||||
|
|
||||||
var selected = [];
|
//params.level.pop(params.level.indexOf(parseInt($(this).val())));
|
||||||
for(var i=0; i < inputs.length; i++) {
|
|
||||||
if (inputs[i].checked == true) {
|
|
||||||
selected.push(inputs[i].value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
var int_level = parseInt($(this).val());
|
||||||
|
|
||||||
|
console.log($(this).is(':checked'));
|
||||||
|
console.log("index: " + params.level.indexOf(int_level));
|
||||||
|
console.log('data: - ' + int_level);
|
||||||
|
|
||||||
|
// if (!params.level.includes(parseInt($(this).val()))) {
|
||||||
|
params.level.splice(params.level.indexOf(int_level), 1);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
request_seleted(selected);
|
console.log(params.level);
|
||||||
|
|
||||||
|
//console.log(params);
|
||||||
|
//console.log($.param(params));
|
||||||
|
window.location.replace(window.location.pathname + '?' + $.param(params));
|
||||||
|
|
||||||
|
//if (params.level.includes($(this).is(':checked'))
|
||||||
|
// var action = $(this).is(':checked');
|
||||||
|
// $.post(
|
||||||
|
// "is_checked", {id: $(this).attr('id'), action: action}
|
||||||
|
// ).done(function(data, statusText, xhr) {
|
||||||
|
// switch(xhr.status) {
|
||||||
|
// case 200:
|
||||||
|
// console.log('');
|
||||||
|
// //window.location.replace(window.location.pathname + '?' + $.param(params));
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .fail(function(data, statusText, xhr){
|
||||||
|
// alert(xhr);
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
|
|
||||||
inputs.click(function() {
|
(function($) {
|
||||||
var checked_count = 0;
|
$.fn.order_sort = function(order, sort) {
|
||||||
var selected = [];
|
params.order = order;
|
||||||
for(var i=0; i < inputs.length; i++) {
|
params.sort = sort;
|
||||||
if (inputs[i].checked == false) {
|
console.log(params);
|
||||||
checked_count += 1;
|
window.location.replace(window.location.pathname + '?' + $.param(params));
|
||||||
$('#checkall').prop('checked', false);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
selected.push(inputs[i].value);
|
|
||||||
console.log(selected);
|
|
||||||
}
|
}
|
||||||
}
|
})(jQuery);
|
||||||
checkall(checked_count);
|
|
||||||
request_seleted(selected);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Sort
|
|
||||||
$("#myTable").tablesorter();
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
98
wotstats/templates/pages/account/technic_user_tank.html
Normal file
98
wotstats/templates/pages/account/technic_user_tank.html
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
{% extends 'layouts/main.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h2>Cтатистика танка</h2>
|
||||||
|
|
||||||
|
<div class="mui-row">
|
||||||
|
<div class="mui-col-md-3">
|
||||||
|
<ul class="mui-tabs">
|
||||||
|
<li class="mui--is-active"><a data-mui-toggle="tab" data-mui-controls="pane-default-1">Суммарная статистика</a></li>
|
||||||
|
<li><a data-mui-toggle="tab" data-mui-controls="pane-default-2">Бои в составе клана</a></li>
|
||||||
|
<li><a data-mui-toggle="tab" data-mui-controls="pane-default-3">Бои в составе роты</a></li>
|
||||||
|
<li><a data-mui-toggle="tab" data-mui-controls="pane-default-5">Оборона Укрепрайона</a></li>
|
||||||
|
<li><a data-mui-toggle="tab" data-mui-controls="pane-default-6">Вылазки Укрепрайона</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="mui-col-md-9">
|
||||||
|
<div class="mui-tabs__pane mui--is-active" id="pane-default-1">
|
||||||
|
<h2>Суммарная статистика</h2>
|
||||||
|
<table class="mui-table mui-table--bordered">
|
||||||
|
{% for c in tank_stats.all %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ texts_statistics['all'][c] }}</td>
|
||||||
|
<td>{{ tank_stats['all'][c] }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mui-tabs__pane" id="pane-default-2">
|
||||||
|
<h2>Бои в составе клана</h2>
|
||||||
|
<table class="mui-table mui-table--bordered">
|
||||||
|
{% for c in tank_stats.clan %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ texts_statistics['clan'][c] }}</td>
|
||||||
|
<td>{{ tank_stats['clan'][c] }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mui-tabs__pane" id="pane-default-3">
|
||||||
|
<h2>Бои в составе роты</h2>
|
||||||
|
<table class="mui-table mui-table--bordered">
|
||||||
|
{% for c in tank_stats['company'] %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ texts_statistics['company'][c] }}</td>
|
||||||
|
<td>{{ tank_stats['company'][c] }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mui-tabs__pane" id="pane-default-4">
|
||||||
|
<h2>Командные бои</h2>
|
||||||
|
<table class="mui-table mui-table--bordered">
|
||||||
|
{% for c in tank_stats['historical'] %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ texts_statistics['historical'][c] }}</td>
|
||||||
|
<td>{{ tank_stats['historical'][c] }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mui-tabs__pane" id="pane-default-5">
|
||||||
|
<h2>Оборона Укрепрайона</h2>
|
||||||
|
<table class="mui-table mui-table--bordered">
|
||||||
|
{% for c in tank_stats['stronghold_defense'] %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ texts_statistics['stronghold_defense'][c] }}</td>
|
||||||
|
<td>{{ tank_stats['stronghold_defense'][c] }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mui-tabs__pane" id="pane-default-6">
|
||||||
|
<h2>Вылазки Укрепрайона</h2>
|
||||||
|
<table class="mui-table mui-table--bordered">
|
||||||
|
{% for c in tank_stats['stronghold_skirmish'] %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ texts_statistics['stronghold_skirmish'][c] }}</td>
|
||||||
|
<td>{{ tank_stats['stronghold_skirmish'][c] }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="mui-tabs__pane" id="pane-default-7">
|
||||||
|
<h2>Разное</h2>
|
||||||
|
<table class="mui-table mui-table--bordered">
|
||||||
|
<p>Поваленые деревья: {{tank_stats['trees_cut']}}
|
||||||
|
{% for c in tank_stats['flags'] %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ texts_statistics['flags'][c] }}</td>
|
||||||
|
<td>{{ tank_stats['flags'][c] }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
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,92 +4,63 @@
|
||||||
<h2>Турниры</h2>
|
<h2>Турниры</h2>
|
||||||
<div class="mui-row">
|
<div class="mui-row">
|
||||||
<div class="mui-col-md-12">
|
<div class="mui-col-md-12">
|
||||||
<table class="mui-table mui-table--bordered">
|
{% if account_balance < 100 %}
|
||||||
<thead>
|
<div class="mui-row">
|
||||||
<tr>
|
<div class="mui-col-md-12" style="background-color: red; color: white;">
|
||||||
<th>ID</th>
|
<h1>Недостаточно денег в кошельке.</h1>
|
||||||
<th>Старт</th>
|
<h2>Необходимо пополнить кошелёк на 100 рублей для участия в турнире.</h2>
|
||||||
<th>Финиш</th>
|
</div>
|
||||||
<th>Ставка</th>
|
</div>
|
||||||
<th>Статус</th>
|
{% else %}
|
||||||
</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' %}
|
{% set allow_apply = 'true' %}
|
||||||
{% for u in rush_list_accounts %}
|
{% for u in rush_list_accounts %}
|
||||||
{% if u.account_id|int == account_id|int %}
|
{% if u.account_id|int == account_id|int %}
|
||||||
{% set allow_apply = 'false' %}
|
{% set allow_apply = 'false' %}
|
||||||
{{ u.account_id }}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
{% if allow_apply == 'true' %}
|
||||||
{% if allow_apply == 'true' %}
|
<div class="mui-row">
|
||||||
<a href="{{ url_for('pages_rush.apply') }}" class="mui-btn mui-btn--primary mui-btn--raised">Участвовать</a>
|
<div class="mui-col-md-12" style="background-color: green; color: white;">
|
||||||
{% else %}
|
<table class="mui-table mui-table--bordered" >
|
||||||
<h3>Вы участвуете, вам необходимо совершить максимальное кол-во побед за время турнира</h3>
|
<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>
|
||||||
|
<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>
|
||||||
|
<p>Турнир начнется в полночь по московскому времени и закончится через 24 часа. Приз будет начислен победителю автоматически, сразу после окончания текущего турнира.</p>
|
||||||
|
<h4>Участники</h4>
|
||||||
|
{% for u in rush_list_accounts %}
|
||||||
|
{% if u.account_id|int == account_id|int %}
|
||||||
|
{{ u.account_id }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</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>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -39,6 +39,4 @@ def index():
|
||||||
def statistics():
|
def statistics():
|
||||||
if not g.user:
|
if not g.user:
|
||||||
return redirect(url_for('pages_home.index'))
|
return redirect(url_for('pages_home.index'))
|
||||||
|
return render_template('pages/account/statistics.html')
|
||||||
return render_template(
|
|
||||||
'pages/account/statistics.html')
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ pages_achievements = Blueprint(
|
||||||
'achievements', __name__, url_prefix='/achievements',
|
'achievements', __name__, url_prefix='/achievements',
|
||||||
template_folder='templates')
|
template_folder='templates')
|
||||||
|
|
||||||
|
|
||||||
def __get_achievements():
|
def __get_achievements():
|
||||||
log.debug(session)
|
log.debug(session)
|
||||||
user_id = parse_wargaming_openid_url(session['openid'])[0]
|
user_id = parse_wargaming_openid_url(session['openid'])[0]
|
||||||
|
|
|
@ -43,9 +43,6 @@ def login():
|
||||||
@pages_home.route('/login', methods=['POST'])
|
@pages_home.route('/login', methods=['POST'])
|
||||||
@oid.loginhandler
|
@oid.loginhandler
|
||||||
def login_post():
|
def login_post():
|
||||||
print request.form
|
|
||||||
print request.args
|
|
||||||
|
|
||||||
if g.user is not None:
|
if g.user is not None:
|
||||||
return redirect(oid.get_next_url())
|
return redirect(oid.get_next_url())
|
||||||
|
|
||||||
|
@ -102,9 +99,11 @@ def logout():
|
||||||
def token():
|
def token():
|
||||||
print request.args
|
print request.args
|
||||||
print request.form
|
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')])
|
# 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'):
|
if request.args.get('status') == 'ok' and request.args.get('access_token'):
|
||||||
token = UserWotTokens.query.filter_by(user=session['user'])
|
token = UserWotTokens.query.filter_by(user=session['user'])
|
||||||
|
@ -177,8 +176,8 @@ def create_or_login(resp):
|
||||||
|
|
||||||
# flash(u'Successfully signed in')
|
# flash(u'Successfully signed in')
|
||||||
g.user = user
|
g.user = user
|
||||||
print session
|
print('session: {}'.format(session))
|
||||||
if not session['token']:
|
if session['token'] is None:
|
||||||
print('not token')
|
print('not token')
|
||||||
return redirect(url_for('pages_home.token'))
|
return redirect(url_for('pages_home.token'))
|
||||||
return redirect(oid.get_next_url())
|
return redirect(oid.get_next_url())
|
||||||
|
|
|
@ -7,7 +7,7 @@ from jinja2 import TemplateNotFound
|
||||||
from wotstats.openid import oid
|
from wotstats.openid import oid
|
||||||
|
|
||||||
from wotstats.database import db
|
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
|
from wotstats.lib import parse_wargaming_openid_url
|
||||||
|
|
||||||
pages_rush = Blueprint(
|
pages_rush = Blueprint(
|
||||||
|
@ -29,52 +29,20 @@ def index():
|
||||||
|
|
||||||
account_id, account_nickname = parse_wargaming_openid_url(session['openid'])
|
account_id, account_nickname = parse_wargaming_openid_url(session['openid'])
|
||||||
|
|
||||||
# #
|
print(session)
|
||||||
# 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()
|
|
||||||
|
|
||||||
|
|
||||||
|
ub = UserWallet.query.filter(UserWallet.user == session['user']).first()
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'pages/rush/index.html',
|
'pages/rush/index.html',
|
||||||
rush_list=rush_list,
|
rush_list=rush_list,
|
||||||
rush_list_accounts=rush_list_accounts,
|
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')
|
@pages_rush.route('/apply.html')
|
||||||
def apply():
|
def apply():
|
||||||
if not g.user:
|
if not g.user:
|
||||||
|
|
|
@ -9,7 +9,7 @@ from wotstats.openid import oid
|
||||||
from wotstats.log import log
|
from wotstats.log import log
|
||||||
from wotstats.database import db
|
from wotstats.database import db
|
||||||
from wotstats.models import User
|
from wotstats.models import User
|
||||||
from wotstats.lib import parse_wargaming_openid_url
|
from wotstats.lib import parse_wargaming_openid_url, get_player_personal_data, statistics as texts_statistics
|
||||||
|
|
||||||
from .technic_list import t
|
from .technic_list import t
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ pages_technic = Blueprint(
|
||||||
def __get_technic():
|
def __get_technic():
|
||||||
log.debug(session)
|
log.debug(session)
|
||||||
user_id = parse_wargaming_openid_url(session['openid'])[0]
|
user_id = parse_wargaming_openid_url(session['openid'])[0]
|
||||||
|
g.wg_user_id = user_id
|
||||||
|
|
||||||
url = "https://api.worldoftanks.ru/wot/account/tanks/"
|
url = "https://api.worldoftanks.ru/wot/account/tanks/"
|
||||||
payload = {
|
payload = {
|
||||||
|
@ -26,6 +27,23 @@ def __get_technic():
|
||||||
"account_id": user_id
|
"account_id": user_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__ = requests.get(url, params=payload).json()
|
||||||
|
xx = __.get('data', {}).get(user_id)
|
||||||
|
return xx
|
||||||
|
|
||||||
|
def __get_technic_user_tank(tank_id):
|
||||||
|
# ?application_id=502910c1c785c3c7ca2e83c9e89bde02&account_id=69552613&tank_id=5121&r_realm=ru&run=1
|
||||||
|
# ?application_id=502910c1c785c3c7ca2e83c9e89bde02&account_id=69552613
|
||||||
|
user_id = parse_wargaming_openid_url(session['openid'])[0]
|
||||||
|
g.wg_user_id = user_id
|
||||||
|
|
||||||
|
url = "https://api.worldoftanks.ru/wot/tanks/stats/"
|
||||||
|
payload = {
|
||||||
|
"application_id": current_app.config['WG_APPLICATION_ID'],
|
||||||
|
"account_id": user_id,
|
||||||
|
"tank_id": tank_id,
|
||||||
|
}
|
||||||
|
|
||||||
__ = requests.get(url, params=payload).json()
|
__ = requests.get(url, params=payload).json()
|
||||||
return __.get('data', {}).get(user_id)
|
return __.get('data', {}).get(user_id)
|
||||||
|
|
||||||
|
@ -36,25 +54,8 @@ def index():
|
||||||
if not g.user:
|
if not g.user:
|
||||||
return redirect(url_for('pages_home.index'))
|
return redirect(url_for('pages_home.index'))
|
||||||
|
|
||||||
# TODO: total accounts
|
|
||||||
#
|
|
||||||
account_technic = list()
|
|
||||||
for x in __get_technic():
|
|
||||||
x['details'] = t.get(str(x['tank_id']))
|
|
||||||
account_technic.append(x)
|
|
||||||
|
|
||||||
return render_template(
|
|
||||||
'pages/account/technic.html',
|
|
||||||
account_technic=account_technic
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pages_technic.route('/list.json')
|
|
||||||
def list_json():
|
|
||||||
if not g.user:
|
|
||||||
return redirect(url_for('pages_home.index'))
|
|
||||||
|
|
||||||
list_levels = []
|
list_levels = []
|
||||||
|
print(request.args.getlist('level[]'))
|
||||||
if len(request.args.getlist('level[]')) > 0:
|
if len(request.args.getlist('level[]')) > 0:
|
||||||
list_levels = []
|
list_levels = []
|
||||||
for i in request.args.getlist('level[]'):
|
for i in request.args.getlist('level[]'):
|
||||||
|
@ -73,4 +74,91 @@ def list_json():
|
||||||
x['details'] = t.get(str(x['tank_id']))
|
x['details'] = t.get(str(x['tank_id']))
|
||||||
account_technic.append(x)
|
account_technic.append(x)
|
||||||
|
|
||||||
return jsonify(technic=account_technic)
|
order_keys = {
|
||||||
|
'level': lambda data: data['details'].get('level', 0),
|
||||||
|
'nation': lambda data: data['details']['nation'],
|
||||||
|
'type': lambda data: data['details']['type'],
|
||||||
|
'name': lambda data: data['details']['name_i18n'],
|
||||||
|
'battles': lambda data: data['statistics']['battles'],
|
||||||
|
'wins': lambda data: data['statistics']['wins'],
|
||||||
|
}
|
||||||
|
if request.args.get('order', 'level') in order_keys:
|
||||||
|
order = order_keys[request.args.get('order', 'level')]
|
||||||
|
else:
|
||||||
|
order = order_keys['level']
|
||||||
|
|
||||||
|
reverse = False if request.args.get('sort') == 'asc' else True
|
||||||
|
|
||||||
|
technic = sorted(account_technic, key=order, reverse=reverse)
|
||||||
|
|
||||||
|
return render_template(
|
||||||
|
'pages/account/technic.html',
|
||||||
|
account_technic=technic,
|
||||||
|
args={
|
||||||
|
'level': list_levels,
|
||||||
|
'sort': reverse,
|
||||||
|
'order': request.args.get('order', 'level'),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pages_technic.route('/list.json')
|
||||||
|
def list_json():
|
||||||
|
if not g.user:
|
||||||
|
return redirect(url_for('pages_home.index'))
|
||||||
|
|
||||||
|
list_levels = []
|
||||||
|
print(request.args.getlist('level'))
|
||||||
|
if len(request.args.getlist('level')) > 0:
|
||||||
|
list_levels = []
|
||||||
|
for i in request.args.getlist('levelss'):
|
||||||
|
list_levels.append(int(i))
|
||||||
|
|
||||||
|
# TODO: total accounts
|
||||||
|
#
|
||||||
|
account_technic = list()
|
||||||
|
|
||||||
|
for x in __get_technic():
|
||||||
|
if len(list_levels) == 0:
|
||||||
|
x['details'] = t.get(str(x['tank_id']))
|
||||||
|
account_technic.append(x)
|
||||||
|
else:
|
||||||
|
if t.get(str(x['tank_id'])).get('level') in list_levels:
|
||||||
|
x['details'] = t.get(str(x['tank_id']))
|
||||||
|
account_technic.append(x)
|
||||||
|
|
||||||
|
order_keys = {
|
||||||
|
'level': lambda data: data['details']['level'],
|
||||||
|
'nation': lambda data: data['details']['nation'],
|
||||||
|
'type': lambda data: data['details']['type'],
|
||||||
|
'name': lambda data: data['details']['name_i18n'],
|
||||||
|
'battles': lambda data: data['statistics']['battles'],
|
||||||
|
'wins': lambda data: data['statistics']['wins'],
|
||||||
|
}
|
||||||
|
if request.args.get('order', 'level') in order_keys:
|
||||||
|
order = order_keys[request.args.get('order', 'level')]
|
||||||
|
else:
|
||||||
|
order = order_keys['level']
|
||||||
|
|
||||||
|
reverse = False if request.args.get('sort') == 'asc' else True
|
||||||
|
|
||||||
|
technic = sorted(account_technic, key=order, reverse=reverse)
|
||||||
|
return jsonify(technic=technic, levels=list_levels)
|
||||||
|
|
||||||
|
|
||||||
|
@pages_technic.route('/<int:user_id>/<int:tank_id>/')
|
||||||
|
def user_tech_stats(user_id, tank_id):
|
||||||
|
"""Summary statistics"""
|
||||||
|
if not g.user:
|
||||||
|
return redirect(url_for('pages_home.index'))
|
||||||
|
|
||||||
|
print(g.user)
|
||||||
|
# TODO: total accounts
|
||||||
|
#
|
||||||
|
tank_stats = __get_technic_user_tank(tank_id)
|
||||||
|
|
||||||
|
return render_template(
|
||||||
|
'pages/account/technic_user_tank.html',
|
||||||
|
tank_stats=tank_stats[0],
|
||||||
|
texts_statistics=texts_statistics,
|
||||||
|
)
|
||||||
|
|
File diff suppressed because one or more lines are too long
Reference in a new issue