Work on issue 11
This commit is contained in:
@@ -110,13 +110,16 @@
|
||||
</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% for mate in tipp_mates %}
|
||||
{% for mandant in mandant_dict %}
|
||||
|
||||
{% for mate in mandant_dict.mandant %}
|
||||
<tr>
|
||||
<td>{{ mate.mate.first_name }}</td>
|
||||
<td>{{ mate.sum_score }}</td>
|
||||
{% for tipp in mate.tipps %}
|
||||
<td>{{ tipp }}</td>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
@@ -316,18 +316,14 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
|
||||
values_list('mandant', flat=True)
|
||||
|
||||
""" get mates """
|
||||
tipp_mates = []
|
||||
mandant_dict = {}
|
||||
for m in mandants:
|
||||
mandant = Mandant.objects.get(id=m)
|
||||
mandant_dict[mandant.name] = []
|
||||
rs = RelUserMandant.objects.filter(mandant=m)
|
||||
for r in rs:
|
||||
"""filter duplicates """
|
||||
d = False
|
||||
for item in tipp_mates:
|
||||
if r.user == item['mate']:
|
||||
d = True
|
||||
|
||||
if d is False:
|
||||
tipp_mates.append({
|
||||
for r in rs:
|
||||
mandant_dict[mandant.name].append({
|
||||
'mate': r.user,
|
||||
'tipps': [],
|
||||
'sum_score': 0
|
||||
@@ -412,7 +408,9 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
|
||||
f.fields['tippTeam1'].widget.attrs['disabled'] = True
|
||||
f.fields['tippTeam2'].widget.attrs['disabled'] = True
|
||||
|
||||
for mate in tipp_mates:
|
||||
""" get tipps from mates """
|
||||
for mandant in mandant_dict:
|
||||
for mate in mandant_dict[mandant]:
|
||||
try:
|
||||
matetipp = Tipp.objects.get(tipperID=mate['mate'],
|
||||
matchID=match.matchID)
|
||||
@@ -460,8 +458,9 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
|
||||
'ls': ls,
|
||||
'season': season,
|
||||
'username': user,
|
||||
'tipp_mates': sorted(tipp_mates, key=lambda k: k['sum_score'],
|
||||
reverse=True),
|
||||
'mandant_dict': mandant_dict,
|
||||
#'tipp_mates': sorted(tipp_mates, key=lambda k: k['sum_score'],
|
||||
#reverse=True),
|
||||
'posts': posts,
|
||||
'has_refresh': has_refresh
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user