-
Notifications
You must be signed in to change notification settings - Fork 0
/
bdg_status.py
53 lines (48 loc) · 1.81 KB
/
bdg_status.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class BuildingStatus:
# if a new status is added to the list, the front-end code should be updated accordingly
TYPES = [
{"key": "constructionProject", "label": "En projet", "public": False},
{
"key": "canceledConstructionProject",
"label": "Projet annulé",
"public": False,
},
{
"key": "ongoingConstruction",
"label": "Construction en cours",
"public": True,
},
{"key": "constructed", "label": "Construit", "public": True},
{"key": "ongoingChange", "label": "En cours de modification", "public": True},
{
"key": "notUsable",
"label": "Non utilisable",
"public": True,
},
{"key": "demolished", "label": "Démoli", "public": True},
]
PUBLIC_TYPES_KEYS = [s["key"] for s in TYPES if s["public"]]
PRIVATE_TYPES_KEYS = [s["key"] for s in TYPES if not s["public"]]
ALL_TYPES_KEYS = [s["key"] for s in TYPES]
DEFAULT_STATUS = "constructed"
# ####### REAL_BUILDINGS_STATUS #######
# Those are the status for buildings having a real physical presence in the world
# It is used in many places:
# eg: default status values in the listing API or the Candidate Inspector to match buildings
REAL_BUILDINGS_STATUS = [
"ongoingConstruction",
"constructed",
"ongoingChange",
"notUsable",
]
# Those are the status which trigger the creation of a "constructed" status
# if the building does not have one
POST_CONSTRUCTED_KEYS = [
"ongoingChange",
"notUsable",
"demolished",
]
TYPES_CHOICES = [(s["key"], s["label"]) for s in TYPES]
@classmethod
def get_label(cls, key):
return next(s["label"] for s in cls.TYPES if s["key"] == key)