grenoble_gru: add endpoint listing intervention reasons (#21987)

This commit is contained in:
Serghei Mihai 2018-02-19 18:09:38 +01:00
parent fe6288a558
commit 00ad73a35c
3 changed files with 74 additions and 4 deletions

View File

@ -107,7 +107,7 @@ class GrenobleGRU(BaseResource):
# comments
'obs_demande_urgente': 1 if 'urgent_demand' in data else 0,
'obs_type_dysfonctionnement': check_value(data, 'dysfonction_type', self.types('//typeDysfonctionnement', True)),
'obs_motif': check_value(data, 'intervention_reason', self.types('//descIntervention', True)),
'obs_motif': check_value(data, 'intervention_reason', self.types('//motif', True)),
'obs_description_probleme': data.get('comment_description', ''),
}
if data['intervention_reason'] == '24':
@ -157,10 +157,14 @@ class GrenobleGRU(BaseResource):
def dysfunction_types(self, request, *args, **kwargs):
return self.types('//typeDysfonctionnement')
@endpoint(name='intervention-types', perm='can_access', description=_('Lists intervention types'))
def intervention_types(self, request, *args, **kwargs):
@endpoint(name='intervention-descriptions', perm='can_access', description=_('Lists intervention descriptions'))
def intervention_descriptions(self, request, *args, **kwargs):
return self.types('//descIntervention')
@endpoint(name='intervention-reasons', perm='can_access', description=_('Lists intervention reasons'))
def intervention_reasons(self, request, *args, **kwargs):
return self.types('//motif')
@endpoint(name='create-demand', perm='can_access', methods=['post'], description=_('Create a demand'))
def create_demand(self, request, *args, **kwargs):
try:

View File

@ -236,4 +236,70 @@
<descIntervention>
<identifiant>24</identifiant><libelle>Réparé</libelle>
</descIntervention>
<motif>
<identifiant>36</identifiant><libelle>A Curer</libelle>
</motif>
<motif>
<identifiant>1</identifiant><libelle>A changer</libelle>
</motif>
<motif>
<identifiant>2</identifiant><libelle>A créer</libelle>
</motif>
<motif>
<identifiant>3</identifiant><libelle>A déplacer</libelle>
</motif>
<motif>
<identifiant>4</identifiant><libelle>A déposer</libelle>
</motif>
<motif>
<identifiant>35</identifiant><libelle>A faucher</libelle>
</motif>
<motif>
<identifiant>5</identifiant><libelle>A modifier</libelle>
</motif>
<motif>
<identifiant>37</identifiant><libelle>A nettoyer</libelle>
</motif>
<motif>
<identifiant>27</identifiant><libelle>A reboucher</libelle>
</motif>
<motif>
<identifiant>6</identifiant><libelle>A redresser</libelle>
</motif>
<motif>
<identifiant>7</identifiant><libelle>A refixer</libelle>
</motif>
<motif>
<identifiant>10</identifiant><libelle>A resceller</libelle>
</motif>
<motif>
<identifiant>11</identifiant><libelle>A retracer</libelle>
</motif>
<motif>
<identifiant>8</identifiant><libelle>A réorienter</libelle>
</motif>
<motif>
<identifiant>38</identifiant><libelle>A élaguer</libelle>
</motif>
<motif>
<identifiant>12</identifiant><libelle>Accidenté</libelle>
</motif>
<motif>
<identifiant>18</identifiant><libelle>Défaut de fonctionnement</libelle>
</motif>
<motif>
<identifiant>33</identifiant><libelle>Déménagement</libelle>
</motif>
<motif>
<identifiant>29</identifiant><libelle>Maintenance</libelle>
</motif>
<motif>
<identifiant>34</identifiant><libelle>Manifestation</libelle>
</motif>
<motif>
<identifiant>20</identifiant><libelle>Manquant</libelle>
</motif>
<motif>
<identifiant>23</identifiant><libelle>Vandalisme</libelle>
</motif>
</demandes>

View File

@ -50,7 +50,7 @@ BASIC_PAYLOAD = {
"intervention_datetime": "2011-02-07T11:34",
"urgent_demand": '1',
"dysfonction_type": '3',
"intervention_reason": '24',
"intervention_reason": '2',
}
DEMAND = """<demande IdGRU="1324" idInterne="422">