---
# System prepended metadata

title: Hakim Help Center

---

# Hakim Help Center
```python=186
def stat_view (request):
    dateajd= date.today() 
    date30joursavant = date.today() - timedelta(days=30)   
    allcovid30jours = Covid.objects.filter(date__range=[date30joursavant, dateajd])
    x=0
    for elem in allcovid30jours:
         x += 1
   
    allcovid = Covid.objects.all()
    user = User.objects.all()
    y=0
    #Envoyer une alerte si qlq positif covid ou j'ai été
    for elemcovid in allcovid:
        dateimpo = elemcovid.date
        ReservationImposteur = Reservation.objects.filter(user=elemcovid.user).filter(date=dateimpo)

        for ElemResImposteur in ReservationImposteur:
            EtaImposteur = ElemResImposteur.etablissement
    
            for elemuser in user:
                ResUser = Reservation.objects.filter(user=elemuser)

                for ElemResUser in ResUser:
                    #CombienParRes = ElemResUser.combien

                    if elemuser != elemcovid.user:
                        L_ensemble_des_reservation_meme_date_pour_un_etablissement = EtaImposteur.reservation_set.filter(date=dateimpo).filter(user=elemuser)
                        #momo = EtaImposteur.reservation_set.filter(date=dateimpo).filter(user=elemcovid.user)
                        #elem_del = len(momo)
                        
                        delta = 0
                        getCovided = Covid.objects.all()
                        
                        
                        for covided in getCovided:
                            # Check si la date impo = date covided
                            if covided.date == dateimpo:
                                delta += 1 
                        if L_ensemble_des_reservation_meme_date_pour_un_etablissement: 
                            CombienParRes = ElemResUser.combien
                            
                            y += (CombienParRes)    
    y -= delta
    #y -= elem_del
    template_values = {"x":x,"y":y,"CombienParRes":delta}           
    return render(request,"stat.html", template_values)



