Work on issue 11
This commit is contained in:
@@ -110,13 +110,16 @@
|
|||||||
</th>
|
</th>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
{% for mate in tipp_mates %}
|
{% for mandant in mandant_dict %}
|
||||||
|
|
||||||
|
{% for mate in mandant_dict.mandant %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ mate.mate.first_name }}</td>
|
<td>{{ mate.mate.first_name }}</td>
|
||||||
<td>{{ mate.sum_score }}</td>
|
<td>{{ mate.sum_score }}</td>
|
||||||
{% for tipp in mate.tipps %}
|
{% for tipp in mate.tipps %}
|
||||||
<td>{{ tipp }}</td>
|
<td>{{ tipp }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -316,22 +316,18 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
|
|||||||
values_list('mandant', flat=True)
|
values_list('mandant', flat=True)
|
||||||
|
|
||||||
""" get mates """
|
""" get mates """
|
||||||
tipp_mates = []
|
mandant_dict = {}
|
||||||
for m in mandants:
|
for m in mandants:
|
||||||
|
mandant = Mandant.objects.get(id=m)
|
||||||
|
mandant_dict[mandant.name] = []
|
||||||
rs = RelUserMandant.objects.filter(mandant=m)
|
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:
|
for r in rs:
|
||||||
tipp_mates.append({
|
mandant_dict[mandant.name].append({
|
||||||
'mate': r.user,
|
'mate': r.user,
|
||||||
'tipps': [],
|
'tipps': [],
|
||||||
'sum_score': 0
|
'sum_score': 0
|
||||||
})
|
})
|
||||||
|
|
||||||
matches = []
|
matches = []
|
||||||
for match in md_matches:
|
for match in md_matches:
|
||||||
@@ -412,25 +408,27 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
|
|||||||
f.fields['tippTeam1'].widget.attrs['disabled'] = True
|
f.fields['tippTeam1'].widget.attrs['disabled'] = True
|
||||||
f.fields['tippTeam2'].widget.attrs['disabled'] = True
|
f.fields['tippTeam2'].widget.attrs['disabled'] = True
|
||||||
|
|
||||||
for mate in tipp_mates:
|
""" get tipps from mates """
|
||||||
try:
|
for mandant in mandant_dict:
|
||||||
matetipp = Tipp.objects.get(tipperID=mate['mate'],
|
for mate in mandant_dict[mandant]:
|
||||||
matchID=match.matchID)
|
try:
|
||||||
if match_started is True:
|
matetipp = Tipp.objects.get(tipperID=mate['mate'],
|
||||||
if matetipp.score is None:
|
matchID=match.matchID)
|
||||||
score = u'\u231B'
|
if match_started is True:
|
||||||
else:
|
if matetipp.score is None:
|
||||||
score = matetipp.score
|
score = u'\u231B'
|
||||||
|
else:
|
||||||
|
score = matetipp.score
|
||||||
|
|
||||||
mate['tipps'].append(str(matetipp.pointsTeam1)
|
mate['tipps'].append(str(matetipp.pointsTeam1)
|
||||||
+ ":" + str(matetipp.pointsTeam2)
|
+ ":" + str(matetipp.pointsTeam2)
|
||||||
+ "(" + str(score) + ")")
|
+ "(" + str(score) + ")")
|
||||||
if match.finished is True:
|
if match.finished is True:
|
||||||
mate['sum_score'] += matetipp.score
|
mate['sum_score'] += matetipp.score
|
||||||
else:
|
else:
|
||||||
mate['tipps'].append(u'\u2714')
|
mate['tipps'].append(u'\u2714')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
mate['tipps'].append(u'\u2717')
|
mate['tipps'].append(u'\u2717')
|
||||||
|
|
||||||
matches.append(item)
|
matches.append(item)
|
||||||
|
|
||||||
@@ -460,8 +458,9 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
|
|||||||
'ls': ls,
|
'ls': ls,
|
||||||
'season': season,
|
'season': season,
|
||||||
'username': user,
|
'username': user,
|
||||||
'tipp_mates': sorted(tipp_mates, key=lambda k: k['sum_score'],
|
'mandant_dict': mandant_dict,
|
||||||
reverse=True),
|
#'tipp_mates': sorted(tipp_mates, key=lambda k: k['sum_score'],
|
||||||
|
#reverse=True),
|
||||||
'posts': posts,
|
'posts': posts,
|
||||||
'has_refresh': has_refresh
|
'has_refresh': has_refresh
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user