average stars voted
This commit is contained in:
@@ -456,6 +456,26 @@ input[type="range"]#volume::-webkit-slider-thumb {
|
|||||||
background-image: url(img/star-inactive.png) !important;
|
background-image: url(img/star-inactive.png) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#average-stars {
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#average-stars .stars {
|
||||||
|
background-image: url(img/star-inactive.png);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
height: 32px;
|
||||||
|
width: 160px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#average-stars .stars-overlay {
|
||||||
|
background-image: url(img/star.png);
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
height: 32px;
|
||||||
|
width: 160px;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
.undo-wrapper {
|
.undo-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: row nowrap;
|
flex-flow: row nowrap;
|
||||||
|
|||||||
@@ -61,4 +61,14 @@ Instellingen
|
|||||||
<label>Nominatie quota:</label>
|
<label>Nominatie quota:</label>
|
||||||
<span>{{user.profile.quota|floatformat:3}}</span>
|
<span>{{user.profile.quota|floatformat:3}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="average-stars" style="margin-top:10px;">
|
||||||
|
<fieldset>
|
||||||
|
<legend>Hoeveel sterren geef jij gemiddeld?</legend>
|
||||||
|
<div class="stars">
|
||||||
|
<div class="stars-overlay" style="width: calc({{average}} * 32px)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
+3
-1
@@ -126,9 +126,11 @@ class SettingsView(LoginRequiredMixin, View):
|
|||||||
def get(self, request):
|
def get(self, request):
|
||||||
backgrounds = Background.objects.all()
|
backgrounds = Background.objects.all()
|
||||||
(profile,created) = Profile.objects.get_or_create(user=request.user)
|
(profile,created) = Profile.objects.get_or_create(user=request.user)
|
||||||
|
average_vote = Vote.objects.filter(user=request.user).aggregate(Avg("points", default=0))['points__avg']
|
||||||
context = {
|
context = {
|
||||||
"backgrounds": backgrounds,
|
"backgrounds": backgrounds,
|
||||||
"currentBackground": (profile.background.id if profile.background else 1)
|
"currentBackground": (profile.background.id if profile.background else 1),
|
||||||
|
"average": average_vote
|
||||||
}
|
}
|
||||||
spt_token = profile.get_or_update_spt()
|
spt_token = profile.get_or_update_spt()
|
||||||
if spt_token:
|
if spt_token:
|
||||||
|
|||||||
Reference in New Issue
Block a user