-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from Wooo589/Jose
Jose
- Loading branch information
Showing
16 changed files
with
151 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from django.db.models.signals import post_save, pre_delete | ||
from django.dispatch import receiver | ||
from django.db.models import Avg | ||
from .models import * | ||
from datetime import timedelta | ||
|
||
@receiver(post_save, sender=Avaliacao) | ||
def update_time(sender, instance, created, **kwargs): | ||
if created: | ||
hospital = instance.hospital | ||
risco = instance.risco | ||
duracao = Avaliacao.objects.filter(hospital=hospital).filter(risco=risco).aggregate(Avg("duracao", default=timedelta(minutes=0))) | ||
minutos = round(duracao["duracao__avg"].seconds / 60) | ||
|
||
if risco == "EMERGENTE": | ||
hospital.tempo_emergente = minutos | ||
hospital.save() | ||
|
||
if risco == "MUITO_URGENTE": | ||
hospital.tempo_muito_urgente = minutos | ||
hospital.save() | ||
|
||
if risco == "URGENTE": | ||
hospital.tempo_urgente = minutos | ||
hospital.save() | ||
|
||
if risco == "POUCO_URGENTE": | ||
hospital.tempo_pouco_urgente = minutos | ||
hospital.save() | ||
|
||
if risco == "NAO_URGENTE": | ||
hospital.tempo_nao_urgente = minutos | ||
hospital.save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,7 @@ | |
</script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script> | ||
<script src="{% static "js/select.js"%}"></script> | ||
<script src="{% static 'js/script-select-menu-e-login-box.js'%}"></script> | ||
</head> | ||
<body> | ||
<!-- MENU SUPERIOR --> | ||
|
@@ -174,19 +175,19 @@ <h3><strong>{{ hospital.nome }}</strong></h3> | |
<div class="tempos_de_espera"> | ||
<div class="tempos"> | ||
<span class="c-orange"></span> | ||
<span>x min</span> | ||
<span>{{ hospital.tempo_muito_urgente}} min</span> | ||
</div> | ||
<div class="tempos"> | ||
<span class="c-yellow"></span> | ||
<span>x min</span> | ||
<span>{{ hospital.tempo_urgente }} min</span> | ||
</div> | ||
<div class="tempos"> | ||
<span class="c-green"></span> | ||
<span>x min</span> | ||
<span>{{ hospital.tempo_pouco_urgente }} min</span> | ||
</div> | ||
<div class="tempos"> | ||
<span class="c-blue"></span> | ||
<span>x min</span> | ||
<span>{{ hospital.tempo_nao_urgente }} min</span> | ||
</div> | ||
</div> | ||
<button class="info"><a href="{% url "mais_informacoes" hospital.cnes %}"><span style="font-size: 22px;">+</span><span> INFORMAÇÕES</span></a></button> | ||
|
@@ -195,8 +196,7 @@ <h3><strong>{{ hospital.nome }}</strong></h3> | |
{% endfor %} | ||
</ul> | ||
</section> | ||
</main> | ||
<script src="{% static 'js/script-select-menu-e-login-box.js'%}"></script> | ||
</main> | ||
<footer> | ||
<p>©MedConnect 2023</p> | ||
<p>Site criado por feudo 9 - "Verde Pântano".</p> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters