Bug Fixes

Fixed #7
Fixed #9
Fixed #11
reminder
Etzelia 2018-10-10 21:42:55 -05:00
parent c8c8e5eeda
commit 52a65272ea
5 changed files with 33 additions and 18 deletions

10
external/stats.py vendored
View File

@ -3,6 +3,8 @@ from minecraft_manager.models import Player
from django.conf import settings
stats_dir = os.path.join(settings.MINECRAFT_BASE_DIR, getattr(settings, "WORLD", "world"), "stats")
stats_filter = getattr(settings, 'STATS_FILTER', [])
def get_score(data):
return data['score']
@ -12,9 +14,13 @@ def get_stats():
stats = {}
for filename in os.listdir(stats_dir):
with open(stats_dir + "/" + filename) as json_file:
j = json.load(json_file)['stats']
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]
uuid = filename.replace(".json", "")
stats[uuid] = j
stats[uuid] = clean
return stats

View File

@ -30,21 +30,12 @@
</body>
<script>
$(document).ready(function() {
var $dataTable = $("#dataTable");
if ($dataTable.length) {
$dataTable.hide();
$dataTable.DataTable({
'initComplete': function(settings, json) {
$dataTable.show();
}
});
}
var $filter = $("#filter");
if ($filter.length) {
$("#stats").filterByText($filter);
}
});
{% block script %}{% endblock %}
</script>
</html>

View File

@ -44,3 +44,15 @@
</table>
{% endif %}
{% endblock %}
{% block script %}
var $dataTable = $("#dataTable");
$dataTable.hide();
$dataTable.DataTable({
'initComplete': function(settings, json) {
$dataTable.show();
},
'lengthChange': false,
'searching': false,
'paging': false
});
{% endblock %}

View File

@ -42,3 +42,13 @@
</table>
{% endif %}
{% endblock %}
{% block script %}
var $dataTable = $("#dataTable");
$dataTable.hide();
$dataTable.DataTable({
'initComplete': function(settings, json) {
$dataTable.show();
}
});
{% endblock %}

View File

@ -268,7 +268,7 @@ class TicketInfo(View):
request.user.username))
ticket.priority = post['priority']
if 'staff' in post and 'resolved' not in post:
if post['staff']:
if not ticket.staff or request.user.is_staff:
staff = User.objects.get(id=post['staff'])
if post['staff'] != str(getattr(ticket.staff, 'id', '-1')):
if post['staff'] == str(request.user.id):
@ -277,11 +277,7 @@ class TicketInfo(View):
else:
API.discord_mcm(
"Ticket #**{0}** was given to **{1}** by **{2}**".format(ticket.id, staff.username, request.user.username))
else:
staff = None
API.discord_mcm(
"Ticket #**{0}** was unclaimed by **{1}**".format(ticket.id, request.user.username))
ticket.staff = staff
ticket.staff = staff
if 'resolved' in post:
API.discord_mcm("Ticket #**{0}** was resolved by **{1}**".format(ticket.id, request.user.username))
ticket.resolved = True