parent
c8c8e5eeda
commit
52a65272ea
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -43,4 +43,16 @@
|
|||
</tbody>
|
||||
</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 %}
|
|
@ -41,4 +41,14 @@
|
|||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block script %}
|
||||
var $dataTable = $("#dataTable");
|
||||
$dataTable.hide();
|
||||
$dataTable.DataTable({
|
||||
'initComplete': function(settings, json) {
|
||||
$dataTable.show();
|
||||
}
|
||||
});
|
||||
{% endblock %}
|
8
views.py
8
views.py
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue