From eb55f60f7e28a3651d77295e0bc67dac3dc8a2bf Mon Sep 17 00:00:00 2001 From: Welton Moura Date: Mon, 30 Dec 2024 15:33:38 -0300 Subject: [PATCH] feat: ticket medio na home --- .../home/__pycache__/views.cpython-313.pyc | Bin 1437 -> 1480 bytes gestaoRaul/home/templates/home.html | 2 ++ gestaoRaul/home/views.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gestaoRaul/home/__pycache__/views.cpython-313.pyc b/gestaoRaul/home/__pycache__/views.cpython-313.pyc index a736b4a0a5d59411b4662fea03a77ce0f7b98684..3ae1bc161f1a894a7d5f86d3c0c60700bfd9e305 100644 GIT binary patch delta 246 zcmbQseS(|!GcPX}0}z-#DoSsi$a|I_#A62H&+8Z&7^X5z?q!sp9K|RyS%z^fSA>u* zHv>Z+OEk~qen#2JFBqF7S);{4+CdZFfjNqhcSO-V9*R_{>;F@6Tu7=VvS&)e1WA|2BdE#Ly-cIDv|>dw>WHa X^HWN5QtgV=C+D-Oa&j?7FoUH5dJi}d delta 196 zcmX@XJ(rvJGcPX}0}$M(%}h6+$a|Kb6Ubo(;?GMM85pKAOzvfrpB%*~GFgUk?c|G$ z3&mNY#X;&pAe14PGeS5*C74T(WpX!D4kOFtA53nOy_mxoStl=KmgE!#Dk^3L5|d9d zdvnPF86eY(PfwO(iJRQQ5-0SLfkCsD=`#ZZPaV?-1_stTrpdoqnq@#LS27gI1F0fe dAaRSsCO1E&G$+-rNNw^gR#i?;#yTdjGyri7EZ+bC diff --git a/gestaoRaul/home/templates/home.html b/gestaoRaul/home/templates/home.html index fe04cab..5095859 100644 --- a/gestaoRaul/home/templates/home.html +++ b/gestaoRaul/home/templates/home.html @@ -24,6 +24,8 @@ RRB&C - DashBoard

Quantidade de Pagamentos

{{ qdt_pagamentos }}

+

Tíket médio

+

R$ {{ ticekMedio |floatformat:2}}

diff --git a/gestaoRaul/home/views.py b/gestaoRaul/home/views.py index f41cdd7..2c55673 100644 --- a/gestaoRaul/home/views.py +++ b/gestaoRaul/home/views.py @@ -10,9 +10,10 @@ def home(request): total_pagamentos = Payments.objects.aggregate(total=Sum('value'))['total'] qdt_pagamentos = Payments.objects.aggregate(total=Count('value'))['total'] pagamentos = Payments.objects.all() + ticekMedio = total_pagamentos / qdt_pagamentos produtos_mais_vendidos = ProductComanda.objects.values('product').annotate( quantidade=Count('product'), nome=F('product__name') ).order_by('-quantidade')[:5] - return render(request, 'home.html', {'total_pagamentos': total_pagamentos, 'pagamentos': pagamentos, 'qdt_pagamentos': qdt_pagamentos, 'produtos_mais_vendidos': produtos_mais_vendidos}) + return render(request, 'home.html', {'total_pagamentos': total_pagamentos, 'pagamentos': pagamentos, 'qdt_pagamentos': qdt_pagamentos, 'produtos_mais_vendidos': produtos_mais_vendidos, 'ticekMedio': ticekMedio})