Compare commits
22 Commits
Author | SHA1 | Date |
---|---|---|
Etzelia | 37dd8e52a4 | |
Etzelia | 2059aeb2d1 | |
Etzelia | 27cd7616ba | |
Etzelia | 10dff6e266 | |
Etzelia | 18cf8ea74d | |
Etzelia | 02d14bc394 | |
Etzelia | 47c0a7c605 | |
Etzelia | 25829377a1 | |
Etzelia | 446d6afc71 | |
Etzelia | 75730c8a7c | |
Etzelia | a1731ce47f | |
Etzelia | 6b8617fe02 | |
Etzelia | dd66a714c6 | |
Etzelia | 712ed95173 | |
Etzelia | a63f482d96 | |
Etzelia | 5357e64591 | |
Etzelia | 0c0a9a0a0a | |
Etzelia | e41e5fe862 | |
Etzelia | 7d131c147f | |
Etzelia | 8128c68559 | |
Etzelia | 3aa28c3f10 | |
Etzelia | 8ea8d07027 |
19
gui.py
19
gui.py
|
@ -1,7 +1,5 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from django.db import connection
|
|
||||||
|
|
||||||
from django_coreprotect.models import CoWorld, GUIResult
|
from django_coreprotect.models import CoWorld, GUIResult
|
||||||
from django_coreprotect.utils import safe_int, checkbox, time_to_form
|
from django_coreprotect.utils import safe_int, checkbox, time_to_form
|
||||||
|
|
||||||
|
@ -107,14 +105,12 @@ def gui_results(form):
|
||||||
coords = []
|
coords = []
|
||||||
radius = form.radius if form.radius else "0"
|
radius = form.radius if form.radius else "0"
|
||||||
if form.x:
|
if form.x:
|
||||||
coords.append(" x BETWEEN {0} - {1} AND {0} + {1}".format(form.x, radius))
|
coords.append(" AND x BETWEEN {0} - {1} AND {0} + {1}".format(form.x, radius))
|
||||||
if form.y:
|
if form.y:
|
||||||
coords.append(" y BETWEEN {0} - {1} AND {0} + {1}".format(form.y, radius))
|
coords.append(" AND y BETWEEN {0} - {1} AND {0} + {1}".format(form.y, radius))
|
||||||
if form.z:
|
if form.z:
|
||||||
coords.append(" z BETWEEN {0} - {1} AND {0} + {1}".format(form.z, radius))
|
coords.append(" AND z BETWEEN {0} - {1} AND {0} + {1}".format(form.z, radius))
|
||||||
coords_clause = ""
|
coords_clause = " AND ".join(coords)
|
||||||
if coords:
|
|
||||||
coords_clause = " AND ({})".format(" AND ".join(coords))
|
|
||||||
|
|
||||||
players = []
|
players = []
|
||||||
players_clause = ""
|
players_clause = ""
|
||||||
|
@ -187,11 +183,8 @@ def gui_results(form):
|
||||||
|
|
||||||
# Chest Use
|
# Chest Use
|
||||||
if form.chest_use:
|
if form.chest_use:
|
||||||
concat = 'CONCAT(cc.amount, " ", cmm.material)'
|
|
||||||
if connection.vendor == "sqlite":
|
|
||||||
concat = 'cc.amount || " " || cmm.material'
|
|
||||||
queries.append('''SELECT
|
queries.append('''SELECT
|
||||||
0 AS id, "container" AS type, cc.time AS unix, cu.user AS player, cc.action, {concat} AS data, cc.x, cc.y, cc.z, cw.world
|
0 AS id, "container" AS type, cc.time AS unix, cu.user AS player, cc.action, cc.amount || " " || cmm.material AS data, cc.x, cc.y, cc.z, cw.world
|
||||||
FROM co_container cc
|
FROM co_container cc
|
||||||
JOIN co_user cu ON cc.user = cu.rowid
|
JOIN co_user cu ON cc.user = cu.rowid
|
||||||
JOIN co_material_map cmm ON cc.type = cmm.rowid
|
JOIN co_material_map cmm ON cc.type = cmm.rowid
|
||||||
|
@ -202,7 +195,7 @@ def gui_results(form):
|
||||||
{coords}
|
{coords}
|
||||||
{blocks}
|
{blocks}
|
||||||
{time}
|
{time}
|
||||||
'''.format(concat=concat, worlds=worlds_clause, players=players_clause, coords=coords_clause, blocks=blocks_clause, time=time_clause))
|
'''.format(worlds=worlds_clause, players=players_clause, coords=coords_clause, blocks=blocks_clause, time=time_clause))
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
if form.command:
|
if form.command:
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for result in results %}
|
{% for result in results %}
|
||||||
<tr {% if result.world %}class="click-row" data-prompt="/tp {{ result.x }} {{ result.y }} {{ result.z }}"{% endif %}>
|
<tr {% if result.x %}class="click-row" data-prompt="/tp {{ result.x }} {{ result.y }} {{ result.z }}"{% endif %}>
|
||||||
<td>{{ result.display_time }}</td>
|
<td>{{ result.display_time }}</td>
|
||||||
<td>{{ result.player }}</td>
|
<td>{{ result.player }}</td>
|
||||||
<td>{{ result.display_action }}</td>
|
<td>{{ result.display_action }}</td>
|
||||||
|
|
Loading…
Reference in New Issue