Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
jolheiser | fd3ffa6857 | |
jolheiser | e1b3319247 | |
jolheiser | e3b0194ebd | |
Etzelia | e5160f3839 | |
Etzelia | fbd29e2c70 |
19
gui.py
19
gui.py
|
@ -1,5 +1,7 @@
|
|||
from datetime import datetime
|
||||
|
||||
from django.db import connection
|
||||
|
||||
from django_coreprotect.models import CoWorld, GUIResult
|
||||
from django_coreprotect.utils import safe_int, checkbox, time_to_form
|
||||
|
||||
|
@ -105,12 +107,14 @@ def gui_results(form):
|
|||
coords = []
|
||||
radius = form.radius if form.radius else "0"
|
||||
if form.x:
|
||||
coords.append(" AND x BETWEEN {0} - {1} AND {0} + {1}".format(form.x, radius))
|
||||
coords.append(" x BETWEEN {0} - {1} AND {0} + {1}".format(form.x, radius))
|
||||
if form.y:
|
||||
coords.append(" AND y BETWEEN {0} - {1} AND {0} + {1}".format(form.y, radius))
|
||||
coords.append(" y BETWEEN {0} - {1} AND {0} + {1}".format(form.y, radius))
|
||||
if form.z:
|
||||
coords.append(" AND z BETWEEN {0} - {1} AND {0} + {1}".format(form.z, radius))
|
||||
coords_clause = " AND ".join(coords)
|
||||
coords.append(" z BETWEEN {0} - {1} AND {0} + {1}".format(form.z, radius))
|
||||
coords_clause = ""
|
||||
if coords:
|
||||
coords_clause = " AND ({})".format(" AND ".join(coords))
|
||||
|
||||
players = []
|
||||
players_clause = ""
|
||||
|
@ -183,8 +187,11 @@ def gui_results(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
|
||||
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
|
||||
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
|
||||
FROM co_container cc
|
||||
JOIN co_user cu ON cc.user = cu.rowid
|
||||
JOIN co_material_map cmm ON cc.type = cmm.rowid
|
||||
|
@ -195,7 +202,7 @@ def gui_results(form):
|
|||
{coords}
|
||||
{blocks}
|
||||
{time}
|
||||
'''.format(worlds=worlds_clause, players=players_clause, coords=coords_clause, blocks=blocks_clause, time=time_clause))
|
||||
'''.format(concat=concat, worlds=worlds_clause, players=players_clause, coords=coords_clause, blocks=blocks_clause, time=time_clause))
|
||||
|
||||
# Commands
|
||||
if form.command:
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
{% for result in results %}
|
||||
<tr {% if result.x %}class="click-row" data-prompt="/tp {{ result.x }} {{ result.y }} {{ result.z }}"{% endif %}>
|
||||
<tr {% if result.world %}class="click-row" data-prompt="/tp {{ result.x }} {{ result.y }} {{ result.z }}"{% endif %}>
|
||||
<td>{{ result.display_time }}</td>
|
||||
<td>{{ result.player }}</td>
|
||||
<td>{{ result.display_action }}</td>
|
||||
|
|
Loading…
Reference in New Issue