forked from Minecraft/minecraft_manager
Added support for filtering at the individual stat level
parent
cfeabc3727
commit
d35b77014f
|
@ -1,4 +1,4 @@
|
|||
import os, json
|
||||
import os, json, copy
|
||||
from minecraft_manager.models import Player
|
||||
from django.conf import settings
|
||||
|
||||
|
@ -16,9 +16,13 @@ def get_stats():
|
|||
with open(stats_dir + "/" + filename) as json_file:
|
||||
raw = json.load(json_file)['stats']
|
||||
clean = {}
|
||||
for r in raw:
|
||||
if not any(sf.lower() in r.lower() for sf in stats_filter):
|
||||
clean[r] = raw[r]
|
||||
raw_copy = copy.deepcopy(raw)
|
||||
for ra in raw_copy:
|
||||
if not any(sf.lower() in ra.lower() for sf in stats_filter):
|
||||
for r in raw_copy[ra]:
|
||||
if any(sf.lower() in r.lower() for sf in stats_filter):
|
||||
del raw[ra][r]
|
||||
clean[ra] = raw[ra]
|
||||
uuid = filename.replace(".json", "")
|
||||
stats[uuid] = clean
|
||||
return stats
|
||||
|
|
Loading…
Reference in New Issue