Minor modification to UI user and admin.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Gregory Trullemans 2022-01-17 10:35:36 +01:00
parent 1fed0bb5db
commit 029f6b6c7f
6 changed files with 39 additions and 26 deletions

View File

@ -80,7 +80,7 @@
paging: false,
searching: false,
ordering: false,
"bInfo" : false,
// "bInfo" : false,
});
});
</script>

View File

@ -3,10 +3,12 @@
{% block header %}
<style>
svg {
/* width: 50%;
height: 50%; */
width: 25%;
height: 25%;
/* width: 50%;
height: 50%; */
width: 25%;
height: 25%;
display: block;
margin: auto;
}
</style>
{% endblock %}
@ -37,26 +39,33 @@
+ (string.split(/j/g).length - 1)
+ (string.split(/l/g).length - 1)
+ (string.split(/t/g).length - 1)
+ (string.split(/\//g).length - 1);
+ (string.split(/\//g).length - 1)
+ (string.split(/,/g).length - 1)
+ (string.split(/\(/g).length - 1)
+ (string.split(/\)/g).length - 1);
number_of_big_char = (string.split(/½/g).length - 1)
+ (string.split(/¾/g).length - 1)
+ (string.split(/B/g).length - 1)
+ (string.split(/O/g).length - 1);
return string.length + (number_of_big_char / 2) - (number_of_spaces + (number_of_small_char / 2));
+ (string.split(/O/g).length - 1)
+ (string.split(/</g).length - 1);
return string.length + (number_of_big_char / 2) - (number_of_spaces + (number_of_small_char / 1.5));
}
function define_font_size(string)
{
return (1 / compute_font_size(string)) * 80;
}
(async () => {
const data = [
{% for key, value in node_dict.items %}
{
"id": "{{ key.short_label }}",
"id": "{{ key.id }}",
"label": "{% autoescape off %}{{ key.short_label }}{% endautoescape %}",
"parentIds": [
{% for prerequisite in value %}
"{{ prerequisite.short_label }}",
{% endfor %}
{% for prerequisite in value %}"{{ prerequisite.id }}", {% endfor %}
]
},
{% endfor %}
},{% endfor %}
]
const dag = d3.dagStratify()(data);
@ -162,12 +171,8 @@
// Add text to nodes
nodes
.append("text")
.text((d) => d.data.id)
// .attr("font-size", "8")
// .attr("font-size", function(d) { return Math.min(2 * d.r, (2 * d.r - 8) / this.getComputedTextLength() * 24) + "px"; })
// .attr("font-size", function(d) {return (1 / d.data.id.length) * 60;})
// .attr("font-size", set_font_size(d.data.id))
.attr("font-size", function(d) {return (1 / compute_font_size(d.data.id)) * 80;})
.text((d) => d.data.label)
.attr("font-size", function(d) {return Math.min(define_font_size(d.data.label), 24);})
.attr("font-weight", "bold")
.attr("font-family", "sans-serif")
.attr("text-anchor", "middle")

View File

@ -11,7 +11,7 @@
<h4 class=""><i class="icon-primary fal fa-laugh-wink"></i> Hi {{ user.username }} !</h4>
</div>
<div class="card-body">
Welcome to Ultron v0.43 <span class="text-muted">(last update : 13-1-2022)</span><br />
Welcome to Ultron v0.44 <span class="text-muted">(last update : 14-1-2022)</span><br />
This application is there to help us manage the gymnasts (evolution, evaluation, routine, scores, ...). It is not perfect so feel free to make improvement proposals, bug reports, … by sending me an <a href="mailto:gregory@flyingacrobaticstrampoline.be">email</a>.<br/>
<br/>
<span class="text-danger"><b>Gelukkig nieuwjaar 2022 en mijn beste wensen!</b></span>

View File

@ -175,6 +175,10 @@ class PrerequisiteClosureAdmin(admin.ModelAdmin):
"ancestor__long_label",
"ancestor__short_label",
)
list_filter = (
("level", DropdownFilter),
("path", DropdownFilter),
)
admin.site.register(TouchPosition, TouchPositionAdmin)

View File

@ -72,10 +72,9 @@ class Educative(Markdownizable):
)
def __str__(self):
return "%s - %s (level: %s | diff: %s)" % (
self.rank,
return "%s (%s - %s)" % (
self.long_label,
self.level,
self.short_label,
self.difficulty,
)

View File

@ -1,5 +1,5 @@
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.db.models import Q, Max, Min
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from django.shortcuts import render, get_object_or_404
from django.views.decorators.http import require_http_methods
@ -130,7 +130,12 @@ def skill_details(request, skill_id):
skill.save()
context = {"skill": skill}
min_tree_level = PrerequisiteClosure.objects.filter(ancestor=skill).aggregate(Min('level'))
# print(min_tree_level)
max_tree_level = PrerequisiteClosure.objects.filter(ancestor=skill).aggregate(Max('level'))
# print(max_tree_level)
context = {"skill": skill, "min_tree_level": min_tree_level, "max_tree_level": max_tree_level}
return render(request, "objectives/skills/details.html", context)