|
|
|
@ -31,7 +31,9 @@ class Axione:
|
|
|
|
|
except Exception as err:
|
|
|
|
|
print("Error while connecting to DB: ", err)
|
|
|
|
|
raise "Could not connect to axione DB"
|
|
|
|
|
cur.execute(f''' SELECT count(name) FROM sqlite_master WHERE type='table' AND name='{AXIONE_REFIMM_TABLE_NAME}' ''')
|
|
|
|
|
cur.execute(
|
|
|
|
|
f""" SELECT count(name) FROM sqlite_master WHERE type='table' AND name='{AXIONE_REFIMM_TABLE_NAME}' """
|
|
|
|
|
)
|
|
|
|
|
self.db_name_refimm = db_name
|
|
|
|
|
if cur.fetchone()[0] == 1:
|
|
|
|
|
self.db_name_refimm = AXIONE_REFIMM_TABLE_NAME
|
|
|
|
@ -51,7 +53,6 @@ class Axione:
|
|
|
|
|
else:
|
|
|
|
|
return 21
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getAreaBuildings(
|
|
|
|
|
self, areaCoordinates: AreaCoordinates, existing_buildings: dict
|
|
|
|
|
) -> dict:
|
|
|
|
@ -109,31 +110,35 @@ class Axione:
|
|
|
|
|
# C'est bien déployé, cependant ce n'est pas encore commandable (donc bientôt et on a la date)
|
|
|
|
|
# On laisse isEligible = True, côté JS il faut regarder le statut pour laj l'affichage en conséquence
|
|
|
|
|
|
|
|
|
|
if isEligible and date_debut:
|
|
|
|
|
if date_debut:
|
|
|
|
|
try:
|
|
|
|
|
date_formatted = datetime.strptime(date_debut, '%Y%m%d').date()
|
|
|
|
|
date_formatted = datetime.strptime(date_debut, "%Y%m%d").date()
|
|
|
|
|
|
|
|
|
|
if date_formatted >= datetime.now().date():
|
|
|
|
|
etatImm = AXIONE_ETAT_DEPLOYE_NON_COMMANDABLE
|
|
|
|
|
date_commandable = date_formatted.strftime('%d/%m/%Y')
|
|
|
|
|
if isEligible:
|
|
|
|
|
etatImm = AXIONE_ETAT_DEPLOYE_NON_COMMANDABLE
|
|
|
|
|
date_commandable = date_formatted.strftime("%d/%m/%Y")
|
|
|
|
|
|
|
|
|
|
except ValueError as err:
|
|
|
|
|
print("Error while mainpulating DateDebutAcceptationCmdAcces from Axione DB: ", err)
|
|
|
|
|
print(
|
|
|
|
|
"Error while mainpulating DateDebutAcceptationCmdAcces from Axione DB: ",
|
|
|
|
|
err,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
aquilenetEligStatus = FAIEligibilityStatus(
|
|
|
|
|
isEligible=isEligible,
|
|
|
|
|
ftthStatus=etatImm,
|
|
|
|
|
reasonNotEligible=reasonNotEligible,
|
|
|
|
|
dateCommandable=date_commandable
|
|
|
|
|
dateCommandable=date_commandable,
|
|
|
|
|
)
|
|
|
|
|
etat_priority = self._get_etat_priority(etatImm)
|
|
|
|
|
if buildings.get(idImm):
|
|
|
|
|
buildings[idImm]["aquilenetEligStatus"] = aquilenetEligStatus
|
|
|
|
|
buildings[idImm]['etat_imm_priority'] = etat_priority
|
|
|
|
|
if buildings[idImm].get('found_in'):
|
|
|
|
|
buildings[idImm]['found_in'].append("axione")
|
|
|
|
|
buildings[idImm]["etat_imm_priority"] = etat_priority
|
|
|
|
|
if buildings[idImm].get("found_in"):
|
|
|
|
|
buildings[idImm]["found_in"].append("axione")
|
|
|
|
|
else:
|
|
|
|
|
buildings[idImm]['found_in'] = ["axione"]
|
|
|
|
|
buildings[idImm]["found_in"] = ["axione"]
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
building = Building(
|
|
|
|
@ -146,11 +151,15 @@ class Axione:
|
|
|
|
|
codePostal=b[7],
|
|
|
|
|
commune=b[8],
|
|
|
|
|
bat_info="",
|
|
|
|
|
found_in = ["axione"],
|
|
|
|
|
found_in=["axione"],
|
|
|
|
|
etat_imm_priority=etat_priority,
|
|
|
|
|
aquilenetEligStatus=aquilenetEligStatus,
|
|
|
|
|
fdnEligStatus=FAIEligibilityStatus(isEligible=False, reasonNotEligible="", ftthStatus=""),
|
|
|
|
|
othersEligStatus=FAIEligibilityStatus(isEligible=False, reasonNotEligible="", ftthStatus=""),
|
|
|
|
|
fdnEligStatus=FAIEligibilityStatus(
|
|
|
|
|
isEligible=False, reasonNotEligible="", ftthStatus=""
|
|
|
|
|
),
|
|
|
|
|
othersEligStatus=FAIEligibilityStatus(
|
|
|
|
|
isEligible=False, reasonNotEligible="", ftthStatus=""
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
buildings[idImm] = building
|
|
|
|
|
return buildings
|
|
|
|
@ -166,28 +175,36 @@ class Axione:
|
|
|
|
|
print("Error while connecting to DB: ", err)
|
|
|
|
|
raise "Could not get Axione data"
|
|
|
|
|
|
|
|
|
|
cur.execute(
|
|
|
|
|
f"""
|
|
|
|
|
SELECT EtatImmeuble, DateDebutAcceptationCmdAcces
|
|
|
|
|
FROM {self.db_name_refimm}
|
|
|
|
|
WHERE IdentifiantImmeuble == '{id_immeuble}'
|
|
|
|
|
"""
|
|
|
|
|
)
|
|
|
|
|
res = cur.fetchone()
|
|
|
|
|
if res:
|
|
|
|
|
imm_elig = res[0]
|
|
|
|
|
isEligible = imm_elig == AXIONE_ETAT_DEPLOYE
|
|
|
|
|
reasonNotEligible = "" if isEligible else "Pas encore deploye"
|
|
|
|
|
else:
|
|
|
|
|
isEligible = False
|
|
|
|
|
try:
|
|
|
|
|
cur.execute(
|
|
|
|
|
f"""
|
|
|
|
|
SELECT EtatImmeuble, DateDebutAcceptationCmdAcces
|
|
|
|
|
FROM {self.db_name_refimm}
|
|
|
|
|
WHERE IdentifiantImmeuble == '{id_immeuble}'
|
|
|
|
|
"""
|
|
|
|
|
)
|
|
|
|
|
res = cur.fetchone()
|
|
|
|
|
if res:
|
|
|
|
|
imm_elig = res[0]
|
|
|
|
|
isEligible = imm_elig == AXIONE_ETAT_DEPLOYE
|
|
|
|
|
reasonNotEligible = "" if isEligible else "Pas encore deploye"
|
|
|
|
|
dateCommandable = res[1]
|
|
|
|
|
else:
|
|
|
|
|
imm_elig = "NOT_AXIONE"
|
|
|
|
|
isEligible = False
|
|
|
|
|
reasonNotEligible = "Axione ne gere pas ce batiment"
|
|
|
|
|
dateCommandable = ""
|
|
|
|
|
except Exception as err:
|
|
|
|
|
imm_elig = "NOT_AXIONE"
|
|
|
|
|
isEligible = False
|
|
|
|
|
reasonNotEligible = "Axione ne gere pas ce batiment"
|
|
|
|
|
dateCommandable = ""
|
|
|
|
|
|
|
|
|
|
eligStatus = FAIEligibilityStatus(
|
|
|
|
|
isEligible=isEligible,
|
|
|
|
|
ftthStatus=imm_elig,
|
|
|
|
|
reasonNotEligible=reasonNotEligible,
|
|
|
|
|
dateCommandable=res[1]
|
|
|
|
|
dateCommandable=dateCommandable,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return eligStatus
|
|
|
|
|