Add block clause

Cast all actions to string for comparison

Signed-off-by: Etzelia <etzelia@hotmail.com>
block_fix
Etzelia 2019-09-28 14:52:11 -05:00
parent 18cf8ea74d
commit 656fb17df2
No known key found for this signature in database
GPG Key ID: 708511AE7ABC5314
2 changed files with 14 additions and 5 deletions

13
gui.py
View File

@ -114,6 +114,13 @@ def gui_results(form):
players.append(player.strip()) players.append(player.strip())
players_clause = " AND ({})".format(" OR ".join(["cu.user LIKE '{}%%'".format(p) for p in players])) players_clause = " AND ({})".format(" OR ".join(["cu.user LIKE '{}%%'".format(p) for p in players]))
blocks = []
blocks_clause = ""
if form.blocks:
for block in form.blocks.split(","):
blocks.append(block.strip())
blocks_clause = " AND ({})".format(" OR ".join(["cmm.material LIKE 'minecraft:{}%'".format(b) for b in blocks]))
worlds_clause = "" worlds_clause = ""
worlds = [world["id"] for world in form.worlds if world["checked"]] worlds = [world["id"] for world in form.worlds if world["checked"]]
if len(worlds): if len(worlds):
@ -147,10 +154,11 @@ def gui_results(form):
{ignore_environment} {ignore_environment}
{players} {players}
{coords} {coords}
{blocks}
{worlds} {worlds}
{time} {time}
'''.format(action=",".join(block_actions), ignore_environment=ignore_environment, players=players_clause, '''.format(action=",".join(block_actions), ignore_environment=ignore_environment, players=players_clause,
coords=coords_clause, worlds=worlds_clause, time=time_clause)) coords=coords_clause, blocks=blocks_clause, worlds=worlds_clause, time=time_clause))
# Chat # Chat
if form.chat: if form.chat:
@ -175,8 +183,9 @@ def gui_results(form):
{worlds} {worlds}
{players} {players}
{coords} {coords}
{blocks}
{time} {time}
'''.format(worlds=worlds_clause, players=players_clause, coords=coords_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:

View File

@ -310,15 +310,15 @@ class GUIResult(models.Model):
@property @property
def display_action(self): def display_action(self):
if self.type == "block": if self.type == "block":
return "Block Break" if self.action == "0" else "Block Place" if self.action == "1" else "Interact/Used" return "Block Break" if str(self.action) == "0" else "Block Place" if str(self.action) == "1" else "Interact/Used"
if self.type == "chat": if self.type == "chat":
return "Chat" return "Chat"
if self.type == "container": if self.type == "container":
return "Took from Container" if self.action == "0" else "Placed in Container" return "Took from Container" if str(self.action) == "0" else "Placed in Container"
if self.type == "command": if self.type == "command":
return "Command" return "Command"
if self.type == "session": if self.type == "session":
return "Logout" if self.action == "0" else "Login" return "Logout" if str(self.action) == "0" else "Login"
if self.type == "sign": if self.type == "sign":
return "Sign" return "Sign"
return self.action return self.action