Compare commits

..

22 Commits

Author SHA1 Message Date
Etzelia 37dd8e52a4
Optimized imports
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-10-01 00:27:22 -05:00
Etzelia 2059aeb2d1
Completed presets
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-10-01 00:25:43 -05:00
Etzelia 27cd7616ba
Start work on presets
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-09-30 17:02:21 -05:00
Etzelia 10dff6e266 Add block clause (#1) 2019-09-28 21:55:29 +02:00
Etzelia 18cf8ea74d Change UNION to UNION ALL 2019-09-25 22:14:54 +02:00
Etzelia 02d14bc394 Change action to compare with strings 2019-09-25 22:03:13 +02:00
Etzelia 47c0a7c605
Improve LIKE query
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-08-20 11:32:54 -05:00
Etzelia 25829377a1
Try to prevent corrupt activity
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-08-16 12:42:29 -05:00
Etzelia 446d6afc71
Update user in activity query
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-08-16 12:39:25 -05:00
Etzelia 75730c8a7c
Convert to HAVING
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-08-16 12:38:10 -05:00
Etzelia a1731ce47f
Escape percent signs in raw SQL
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-08-16 12:26:39 -05:00
Etzelia 6b8617fe02
Convert id to rowid
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-08-16 12:15:30 -05:00
Etzelia dd66a714c6
New migration
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-08-16 11:46:28 -05:00
Etzelia 712ed95173
Add activity pages
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-08-16 11:46:09 -05:00
Etzelia a63f482d96
Finish pagination
Re-work permissions (and test)
Move form methods to separate file

Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-08-15 22:59:43 -05:00
Etzelia 5357e64591
Start pagination
SQL is finished

Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-08-15 17:00:54 -05:00
Etzelia 0c0a9a0a0a
Half SQL completed
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-08-14 16:56:05 -05:00
Etzelia e41e5fe862
Move to Bulma
Start UI work

Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-08-13 17:05:34 -05:00
Etzelia 7d131c147f
More work
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-07-28 14:15:45 -05:00
Etzelia 8128c68559
Add migration
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-07-26 22:22:42 -05:00
Etzelia 3aa28c3f10
More work
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-07-26 22:22:29 -05:00
Etzelia 8ea8d07027
Initial local commit
Signed-off-by: Etzelia <etzelia@hotmail.com>
2019-07-26 12:36:03 -05:00
2 changed files with 7 additions and 14 deletions

19
gui.py
View File

@ -1,7 +1,5 @@
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
@ -107,14 +105,12 @@ def gui_results(form):
coords = []
radius = form.radius if form.radius else "0"
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:
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:
coords.append(" z BETWEEN {0} - {1} AND {0} + {1}".format(form.z, radius))
coords_clause = ""
if coords:
coords_clause = " AND ({})".format(" AND ".join(coords))
coords.append(" AND z BETWEEN {0} - {1} AND {0} + {1}".format(form.z, radius))
coords_clause = " AND ".join(coords)
players = []
players_clause = ""
@ -187,11 +183,8 @@ 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, {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
JOIN co_user cu ON cc.user = cu.rowid
JOIN co_material_map cmm ON cc.type = cmm.rowid
@ -202,7 +195,7 @@ def gui_results(form):
{coords}
{blocks}
{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
if form.command:

View File

@ -13,7 +13,7 @@
</thead>
<tbody>
{% 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.player }}</td>
<td>{{ result.display_action }}</td>