Доработка отчета + рефактор
This commit is contained in:
parent
d1803db65a
commit
c730af39f2
@ -78,18 +78,17 @@ class ReportService:
|
||||
for cheque in cheques:
|
||||
month_key = cheque.uploaded_at.strftime('%Y-%m')
|
||||
if month_key not in cheques_by_month or \
|
||||
cheque.uploaded_at > cheques_by_month[
|
||||
month_key].uploaded_at:
|
||||
cheque.uploaded_at > cheques_by_month[month_key].uploaded_at:
|
||||
cheques_by_month[month_key] = cheque
|
||||
|
||||
latest_contract = Contract.objects.filter(user=user).latest(
|
||||
'uploaded_at')
|
||||
latest_contract = Contract.objects.filter(user=user).order_by(
|
||||
'uploaded_at').last()
|
||||
|
||||
user_dict = {
|
||||
"id": user.id,
|
||||
"name": user.get_name(),
|
||||
"visits_count": user_circles_count,
|
||||
"contract": f'{host_url}{latest_contract.file.url}',
|
||||
"contract": f'{host_url}{latest_contract.file.url}' if user_has_contract else None,
|
||||
"cheques": [
|
||||
{
|
||||
"month": f"{months_names[cheque.uploaded_at.strftime('%m')]} "
|
||||
|
||||
@ -100,18 +100,20 @@
|
||||
<b>Количество посещений: </b>
|
||||
<a href="{% url 'report:circle_history' not_accessed.id %}?date_start={{ date_start }}&date_end={{ date_end }}">{{ not_accessed.visits_count }}/{{ required_count }}</a>
|
||||
</p>
|
||||
<a href="{{ not_accessed.contract }}" class="btn btn-outline-primary">Договор</a>
|
||||
{% if not_accessed.contract %}
|
||||
<a href="{{ not_accessed.contract }}" class="btn btn-outline-primary">Договор</a>
|
||||
{% endif %}
|
||||
{% for cheque in not_accessed.cheques %}
|
||||
<a href="{{ cheque.url }}" class="btn btn-outline-primary">Чек
|
||||
за {{ cheque.month }}</a>
|
||||
{% endfor %}
|
||||
<h6 class="mt-3">Причины отказа:</h6>
|
||||
<ul>
|
||||
{% for reason in not_accessed.reasons %}
|
||||
<li>
|
||||
{{ reason }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% for reason in not_accessed.reasons %}
|
||||
<li>
|
||||
{{ reason }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
</ul>
|
||||
<hr>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user