Revision 08bf3477
Added by Mikaël Ates almost 12 years ago
calebasse/actes/models.py | ||
---|---|---|
142 | 142 |
|
143 | 143 |
def is_absent(self): |
144 | 144 |
state = self.get_state() |
145 |
if state and state.state_name in ('ABS_NON_EXC', 'ABS_EXC', 'ANNUL_NOUS', |
|
145 |
if state and state.state_name in ('ABS_NON_EXC', 'ABS_EXC', 'ABS_INTER', 'ANNUL_NOUS',
|
|
146 | 146 |
'ANNUL_FAMILLE', 'REPORTE', 'ABS_ESS_PPS', 'ENF_HOSP'): |
147 | 147 |
return True |
148 | 148 |
return False |
calebasse/actes/tests.py | ||
---|---|---|
62 | 62 |
act_event6.act.set_state('VALIDE', creator) |
63 | 63 |
|
64 | 64 |
result = automated_validation(date(2020, 10, 2), service, creator, commit=False) |
65 |
self.assertEqual(result, (5,2,2,0,1,0,0,0,0,0)) |
|
65 |
self.assertEqual(result, (5,2,2,0,1,0,0,0,0,0,0,0))
|
|
66 | 66 |
self.assertTrue(act_event.act.is_state('NON_VALIDE')) |
67 | 67 |
self.assertTrue(act_event2.act.is_state('NON_VALIDE')) |
68 | 68 |
self.assertTrue(act_event3.act.is_state('ABS_EXC')) |
... | ... | |
71 | 71 |
self.assertTrue(act_event6.act.is_state('VALIDE')) |
72 | 72 |
|
73 | 73 |
result = automated_validation(date(2020, 10, 2), service, creator) |
74 |
self.assertEqual(result, (5,2,2,0,1,0,0,0,0,0)) |
|
74 |
self.assertEqual(result, (5,2,2,0,1,0,0,0,0,0,0,0))
|
|
75 | 75 |
|
76 | 76 |
self.assertTrue(act_event.act.is_state('VALIDE')) |
77 | 77 |
self.assertTrue(act_event2.act.is_state('ACT_DOUBLE')) |
... | ... | |
87 | 87 |
[date(2020, 10, 3), date(2020, 10, 4)]) |
88 | 88 |
|
89 | 89 |
result = automated_validation(datetime(2020, 10, 2, 12, 20), service, creator, commit=False) |
90 |
self.assertEqual(result, (5,2,2,0,1,0,0,0,0,0)) |
|
90 |
self.assertEqual(result, (5,2,2,0,1,0,0,0,0,0,0,0))
|
|
91 | 91 |
self.assertTrue(act_event.act.is_state('VALIDE')) |
92 | 92 |
self.assertTrue(act_event2.act.is_state('ACT_DOUBLE')) |
93 | 93 |
self.assertTrue(act_event3.act.is_state('ABS_EXC')) |
... | ... | |
96 | 96 |
self.assertTrue(act_event6.act.is_state('ACT_DOUBLE')) |
97 | 97 |
|
98 | 98 |
result = automated_validation(datetime(2020, 10, 2, 12, 20), service, creator) |
99 |
self.assertEqual(result, (5,2,2,0,1,0,0,0,0,0)) |
|
99 |
self.assertEqual(result, (5,2,2,0,1,0,0,0,0,0,0,0))
|
|
100 | 100 |
self.assertTrue(act_event.act.is_state('VALIDE')) |
101 | 101 |
self.assertTrue(act_event2.act.is_state('ACT_DOUBLE')) |
102 | 102 |
self.assertTrue(act_event3.act.is_state('ABS_EXC')) |
... | ... | |
105 | 105 |
self.assertTrue(act_event6.act.is_state('ACT_DOUBLE')) |
106 | 106 |
|
107 | 107 |
result = automated_validation(datetime(2020, 10, 2, 12, 20), service, creator, commit=False) |
108 |
self.assertEqual(result, (5,2,2,0,1,0,0,0,0,0)) |
|
108 |
self.assertEqual(result, (5,2,2,0,1,0,0,0,0,0,0,0))
|
|
109 | 109 |
self.assertTrue(act_event.act.is_state('VALIDE')) |
110 | 110 |
self.assertTrue(act_event2.act.is_state('ACT_DOUBLE')) |
111 | 111 |
self.assertTrue(act_event3.act.is_state('ABS_EXC')) |
calebasse/actes/validation.py | ||
---|---|---|
50 | 50 |
nb_acts_validated = 0 |
51 | 51 |
nb_acts_abs_non_exc = 0 |
52 | 52 |
nb_acts_abs_exc = 0 |
53 |
nb_acts_abs_inter = 0 |
|
53 | 54 |
nb_acts_annul_nous = 0 |
54 | 55 |
nb_acts_annul_famille = 0 |
55 | 56 |
nb_acts_reporte = 0 |
56 | 57 |
nb_acts_abs_ess_pps = 0 |
57 | 58 |
nb_acts_enf_hosp = 0 |
59 |
nb_acts_losts = 0 |
|
58 | 60 |
acts_of_the_day = get_acts_of_the_day(date, service) |
59 | 61 |
for act in acts_of_the_day: |
60 | 62 |
if act.is_state('ABS_NON_EXC'): |
61 | 63 |
nb_acts_abs_non_exc = nb_acts_abs_non_exc + 1 |
62 | 64 |
if act.is_state('ABS_EXC'): |
63 | 65 |
nb_acts_abs_exc = nb_acts_abs_exc + 1 |
66 |
if act.is_state('ABS_INTER'): |
|
67 |
nb_acts_abs_inter = nb_acts_abs_inter + 1 |
|
64 | 68 |
if act.is_state('ANNUL_NOUS'): |
65 | 69 |
nb_acts_annul_nous = nb_acts_annul_nous + 1 |
66 | 70 |
if act.is_state('ANNUL_FAMILLE'): |
... | ... | |
71 | 75 |
nb_acts_abs_ess_pps = nb_acts_abs_ess_pps + 1 |
72 | 76 |
if act.is_state('ENF_HOSP'): |
73 | 77 |
nb_acts_enf_hosp = nb_acts_enf_hosp + 1 |
78 |
if act.is_state('ACT_LOST'): |
|
79 |
nb_acts_losts = nb_acts_losts + 1 |
|
74 | 80 |
|
75 | 81 |
nb_acts_total = len(acts_of_the_day) |
76 | 82 |
patients = {} |
... | ... | |
127 | 133 |
patient.create_diag_healthcare(user) |
128 | 134 |
patient.automated_switch_state(user) |
129 | 135 |
return (nb_acts_total, nb_acts_validated, nb_acts_double, |
130 |
nb_acts_abs_non_exc, nb_acts_abs_exc, nb_acts_annul_nous, |
|
136 |
nb_acts_abs_non_exc, nb_acts_abs_exc, nb_acts_abs_inter, nb_acts_annul_nous,
|
|
131 | 137 |
nb_acts_annul_famille, nb_acts_reporte, nb_acts_abs_ess_pps, |
132 |
nb_acts_enf_hosp) |
|
138 |
nb_acts_enf_hosp, nb_acts_losts) |
calebasse/actes/validation_states.py | ||
---|---|---|
8 | 8 |
VALIDE = u'Présent' |
9 | 9 |
ABS_NON_EXC = u'Absence non excusée' |
10 | 10 |
ABS_EXC = u'Absence excusée' |
11 |
ABS_INTER = u'Absence intervenant' |
|
11 | 12 |
ANNUL_NOUS = u'Annulé par nous' |
12 | 13 |
ANNUL_FAMILLE = u'Annulé par la famille' |
13 | 14 |
REPORTE = u'Reporté' |
14 | 15 |
ABS_ESS_PPS = u'Absence ESS PPS' |
15 | 16 |
ENF_HOSP = u'Enfant hospitalisé' |
16 | 17 |
ACT_DOUBLE = u'Acte en double' |
18 |
ACT_LOST = u'Acte perdu' |
|
17 | 19 |
|
18 | 20 |
VALIDATION_STATES = {'NON_VALIDE': NON_VALIDE, |
19 | 21 |
'VALIDE': VALIDE, |
20 | 22 |
'ABS_NON_EXC': ABS_NON_EXC, |
21 | 23 |
'ABS_EXC': ABS_EXC, |
24 |
'ABS_INTER' : ABS_INTER, |
|
22 | 25 |
'ANNUL_NOUS': ANNUL_NOUS, |
23 | 26 |
'ANNUL_FAMILLE': ANNUL_FAMILLE, |
24 | 27 |
'REPORTE': REPORTE, |
25 | 28 |
'ABS_ESS_PPS': ABS_ESS_PPS, |
26 | 29 |
'ENF_HOSP': ENF_HOSP, |
27 |
'ACT_DOUBLE': ACT_DOUBLE} |
|
30 |
'ACT_DOUBLE': ACT_DOUBLE, |
|
31 |
'ACT_LOST': ACT_LOST} |
calebasse/agenda/templates/agenda/automated-validation.html | ||
---|---|---|
7 | 7 |
<li>Actes non validés : {{nb_acts_not_validated}}</li> |
8 | 8 |
<ul> |
9 | 9 |
{% if nb_acts_double %}<li>Actes en double : {{nb_acts_double}}</li>{% endif %} |
10 |
{% if nb_acts_abs_non_exc %}<li>Abscence non excusée : {{nb_acts_abs_non_exc}}</li>{% endif %} |
|
11 |
{% if nb_acts_abs_exc %}<li>Abscence excusée : {{nb_acts_abs_exc}}</li>{% endif %} |
|
12 |
{% if nb_acts_annul_nous %}<li>Annulé par nous : {{nb_acts_annul_nous}}</li>{% endif %} |
|
13 |
{% if nb_acts_annul_famille %}<li>Annulé par la famille : {{nb_acts_annul_famille}}</li>{% endif %} |
|
14 |
{% if nb_acts_abs_ess_pps %}<li>Abscence ESS PPS : {{nb_acts_abs_ess_pps}}</li>{% endif %} |
|
15 |
{% if nb_acts_enf_hosp %}<li>Enfant hospitalisé : {{nb_acts_enf_hosp}}</li>{% endif %} |
|
10 |
{% if nb_acts_abs_non_exc %}<li>Abscences non excusées : {{nb_acts_abs_non_exc}}</li>{% endif %} |
|
11 |
{% if nb_acts_abs_exc %}<li>Abscences excusées : {{nb_acts_abs_exc}}</li>{% endif %} |
|
12 |
{% if nb_acts_abs_inter %}<li>Abscences intervenants : {{nb_acts_abs_exc}}</li>{% endif %} |
|
13 |
{% if nb_acts_annul_nous %}<li>Annulés par nous : {{nb_acts_annul_nous}}</li>{% endif %} |
|
14 |
{% if nb_acts_annul_famille %}<li>Annulés par la famille : {{nb_acts_annul_famille}}</li>{% endif %} |
|
15 |
{% if nb_acts_abs_ess_pps %}<li>Abscences ESS PPS : {{nb_acts_abs_ess_pps}}</li>{% endif %} |
|
16 |
{% if nb_acts_enf_hosp %}<li>Absences pour enfant hospitalisé : {{nb_acts_enf_hosp}}</li>{% endif %} |
|
17 |
{% if nb_acts_losts %}<li>Actes perdus : {{nb_acts_losts}}</li>{% endif %} |
|
16 | 18 |
</ul> |
17 | 19 |
{% endif %} |
18 | 20 |
</ul> |
calebasse/agenda/views.py | ||
---|---|---|
270 | 270 |
context = super(AutomatedValidationView, self).get_context_data(**kwargs) |
271 | 271 |
request = self.request |
272 | 272 |
(nb_acts_total, nb_acts_validated, nb_acts_double, |
273 |
nb_acts_abs_non_exc, nb_acts_abs_exc, nb_acts_annul_nous,
|
|
274 |
nb_acts_annul_famille, nb_acts_reporte, nb_acts_abs_ess_pps,
|
|
275 |
nb_acts_enf_hosp) = \
|
|
273 |
nb_acts_abs_non_exc, nb_acts_abs_exc, nb_acts_abs_inter, nb_acts_annul_nous,
|
|
274 |
nb_acts_annul_famille, nb_acts_reporte, nb_acts_abs_ess_pps, |
|
275 |
nb_acts_enf_hosp, nb_acts_losts) = \
|
|
276 | 276 |
automated_validation(self.date, self.service, |
277 | 277 |
request.user, commit = False) |
278 | 278 |
|
279 | 279 |
nb_acts_not_validated = nb_acts_double + \ |
280 | 280 |
nb_acts_abs_non_exc + \ |
281 | 281 |
nb_acts_abs_exc + \ |
282 |
nb_acts_abs_inter + \ |
|
282 | 283 |
nb_acts_annul_nous + \ |
283 | 284 |
nb_acts_annul_famille + \ |
284 | 285 |
nb_acts_reporte + \ |
285 | 286 |
nb_acts_abs_ess_pps + \ |
286 |
nb_acts_enf_hosp |
|
287 |
nb_acts_enf_hosp + \ |
|
288 |
nb_acts_losts |
|
287 | 289 |
context.update({ |
288 | 290 |
'nb_acts_total': nb_acts_total, |
289 | 291 |
'nb_acts_validated': nb_acts_validated, |
... | ... | |
291 | 293 |
'nb_acts_double': nb_acts_double, |
292 | 294 |
'nb_acts_abs_non_exc': nb_acts_abs_non_exc, |
293 | 295 |
'nb_acts_abs_exc': nb_acts_abs_exc, |
296 |
'nb_acts_abs_inter': nb_acts_abs_inter, |
|
294 | 297 |
'nb_acts_annul_nous': nb_acts_annul_nous, |
295 | 298 |
'nb_acts_annul_famille': nb_acts_annul_famille, |
296 | 299 |
'nb_acts_reporte': nb_acts_reporte, |
297 | 300 |
'nb_acts_abs_ess_pps': nb_acts_abs_ess_pps, |
298 |
'nb_acts_enf_hosp': nb_acts_enf_hosp}) |
|
301 |
'nb_acts_enf_hosp': nb_acts_enf_hosp, |
|
302 |
'nb_acts_losts': nb_acts_losts}) |
|
299 | 303 |
return context |
300 | 304 |
|
301 | 305 |
class UnlockAllView(CreateView): |
Also available in: Unified diff
actes: add two new validation states.