✅ Résolution manuelle du conflit dans domo91.py
This commit is contained in:
0
Docs/Commandes pratiques terminal
Normal file
0
Docs/Commandes pratiques terminal
Normal file
20
Docs/update_product_from_develop.txt
Normal file
20
Docs/update_product_from_develop.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
📝 Exécution du script update_product_from_develop.sh sous Windows
|
||||
🎯 Objectif :
|
||||
Mettre à jour les fichiers déjà présents dans la branche product depuis develop,
|
||||
sans importer les nouveaux fichiers.
|
||||
|
||||
✅ Étapes à retenir (avec Git Bash)
|
||||
Ouvrir Git Bash
|
||||
(depuis Démarrer → Git Bash)
|
||||
|
||||
Naviguer dans ton projet :
|
||||
cd "/c/Users/miche/PycharmProjects/Gestion sondes/tools"
|
||||
Rendre le script exécutable une seule fois :
|
||||
chmod +x update_product_from_develop.sh
|
||||
Exécuter le script à tout moment :
|
||||
./update_product_from_develop.sh
|
||||
|
||||
🔁 Résultat :
|
||||
1) Seuls les fichiers déjà présents dans product sont mis à jour
|
||||
2) Les fichiers nouveaux de develop sont ignorés
|
||||
3) Affichage clair de ce qui est mis à jour ou non
|
||||
35
Purge_alertes.py
Normal file
35
Purge_alertes.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# Purges des entrées de toutes les tables dans la base Sondes qui commencent
|
||||
# par Alertes_*** et qui sont agées de plus de sept jours.
|
||||
import mysql.connector
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Charger les variables d'environnement
|
||||
load_dotenv()
|
||||
|
||||
config = {
|
||||
"host": os.getenv("DB_HOST"),
|
||||
"user": os.getenv("DB_USER"),
|
||||
"password": os.getenv("DB_PASSWORD"),
|
||||
"database": os.getenv("DB_NAME")
|
||||
}
|
||||
|
||||
conn = mysql.connector.connect(**config)
|
||||
cursor = conn.cursor()
|
||||
|
||||
# Récupérer toutes les tables d'alertes
|
||||
cursor.execute("SHOW TABLES")
|
||||
tables = [t[0] for t in cursor.fetchall()]
|
||||
alertes_tables = [t for t in tables if t.startswith("Alertes_")]
|
||||
|
||||
# Appliquer la purge à chaque table
|
||||
for table in alertes_tables:
|
||||
query = f"DELETE FROM {table} WHERE Debut_defaut < NOW() - INTERVAL 7 DAY"
|
||||
cursor.execute(query)
|
||||
print(f"✅ Table {table} purgée.")
|
||||
|
||||
conn.commit()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
print("🎉 Purge terminée pour toutes les alertes anciennes.")
|
||||
16
detect_encodage.py
Normal file
16
detect_encodage.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import os
|
||||
|
||||
racine = "." # point de départ = dossier courant
|
||||
|
||||
def detect_fichiers_non_utf8(dossier):
|
||||
for root, dirs, files in os.walk(dossier):
|
||||
for file in files:
|
||||
if file.endswith(".py"):
|
||||
chemin = os.path.join(root, file)
|
||||
try:
|
||||
with open(chemin, encoding="utf-8") as f:
|
||||
f.read()
|
||||
except UnicodeDecodeError:
|
||||
print(f"⚠️ Encodage non UTF-8 : {chemin}")
|
||||
|
||||
detect_fichiers_non_utf8(racine)
|
||||
41
domo91.py
41
domo91.py
@@ -32,7 +32,6 @@ db_config = {
|
||||
"database": os.getenv("DB_NAME")
|
||||
}
|
||||
|
||||
|
||||
# --- Fonction de génération PDF ---
|
||||
def generer_pdf(site, date_str):
|
||||
st.info(f"Génération du rapport PDF pour {site} à la date {date_str}")
|
||||
@@ -124,7 +123,11 @@ if "lieu_autorise" not in st.session_state:
|
||||
st.session_state["lieu_autorise"] = None
|
||||
|
||||
# --- Connexion utilisateur dans la sidebar ---
|
||||
<<<<<<< HEAD
|
||||
st.sidebar.header("🔐 Connexion")
|
||||
=======
|
||||
st.sidebar.header("🔐 Connexion")
|
||||
>>>>>>> origin/develop
|
||||
if not st.session_state.get("authenticated"):
|
||||
login = st.sidebar.text_input("Nom d'utilisateur")
|
||||
password = st.sidebar.text_input("Mot de passe", type="password")
|
||||
@@ -271,10 +274,12 @@ if st.session_state["authenticated"]:
|
||||
|
||||
# --- NAVIGATION ---
|
||||
if st.session_state["role"] == "superviseur":
|
||||
onglet = st.sidebar.radio("📁 Navigation", ["Accueil", "Statistiques"])
|
||||
|
||||
onglet = st.sidebar.radio("📁 Navigation", ["Accueil", "Statistiques", "Traffic"])
|
||||
# --- ONGLET ACCUEIL ---
|
||||
else:
|
||||
onglet = "Accueil"
|
||||
|
||||
>>>>>>> origin/develop
|
||||
if onglet == "Accueil":
|
||||
st.markdown("## Sélection du site et de la date")
|
||||
try:
|
||||
@@ -354,7 +359,11 @@ if st.session_state["authenticated"]:
|
||||
|
||||
except Exception as e:
|
||||
st.error(f"Erreur MySQL : {e}")
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
# ---- ONGLET STATISTIQUES ---
|
||||
>>>>>>> origin/develop
|
||||
elif onglet == "Statistiques":
|
||||
st.markdown("## 📈 Statistiques de température")
|
||||
try:
|
||||
@@ -485,6 +494,32 @@ if st.session_state["authenticated"]:
|
||||
|
||||
except Exception as e:
|
||||
st.error(f"Erreur SQL (admin) : {e}")
|
||||
<<<<<<< HEAD
|
||||
|
||||
except exception as err:
|
||||
st.error(f"Erreur MySQL : {err}")
|
||||
=======
|
||||
|
||||
# --- ONGLET TRAFFIC ------
|
||||
elif onglet == "Traffic":
|
||||
st.markdown("## 🚦 Connexions récentes")
|
||||
try:
|
||||
conn = mysql.connector.connect(**db_config)
|
||||
cursor = conn.cursor(dictionary=True)
|
||||
cursor.execute(
|
||||
"SELECT Utilisateur, Lieu, Date_Connexion FROM Connexion_Log ORDER BY Date_Connexion DESC LIMIT 200")
|
||||
connexions = cursor.fetchall()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
|
||||
if connexions:
|
||||
df_connexions = pd.DataFrame(connexions)
|
||||
st.dataframe(df_connexions, use_container_width=True)
|
||||
else:
|
||||
st.info("Aucune connexion enregistrée.")
|
||||
except Exception as e:
|
||||
st.error(f"Erreur chargement des connexions : {e}")
|
||||
|
||||
except exception as err:
|
||||
st.error(f"Erreur MySQL : {err}")
|
||||
>>>>>>> origin/develop
|
||||
|
||||
33
tools/update_product_from_develop.sh
Normal file
33
tools/update_product_from_develop.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ---------------------------------------------
|
||||
# Script : update_product_from_develop.sh
|
||||
# Objectif : Met à jour les fichiers de 'product' depuis 'develop'
|
||||
# uniquement pour les fichiers déjà existants dans product
|
||||
# ---------------------------------------------
|
||||
|
||||
echo "📁 Branche active : $(git branch --show-current)"
|
||||
|
||||
# Vérification qu'on est bien sur 'product'
|
||||
current_branch=$(git branch --show-current)
|
||||
if [ "$current_branch" != "product" ]; then
|
||||
echo "❌ Tu n'es pas sur la branche 'product'. Abandon."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Lister les fichiers présents dans 'product'
|
||||
echo "📄 Création de la liste des fichiers dans 'product'..."
|
||||
git ls-tree --name-only -r product > product_files.txt
|
||||
|
||||
echo "🔄 Mise à jour des fichiers depuis 'develop'..."
|
||||
|
||||
while IFS= read -r file; do
|
||||
if git show develop:"$file" > /dev/null 2>&1; then
|
||||
git checkout develop -- "$file"
|
||||
echo "✅ Mis à jour : $file"
|
||||
else
|
||||
echo "❌ Absent dans develop : $file"
|
||||
fi
|
||||
done < product_files.txt
|
||||
|
||||
echo "✅ Mise à jour terminée."
|
||||
0
tools/update_product_from_develop.txt
Normal file
0
tools/update_product_from_develop.txt
Normal file
Reference in New Issue
Block a user