Commit a5fcb030 authored by Adrien Simon's avatar Adrien Simon
Browse files

Statistiques nombre de msg unsent ajoutées

parent 487be740
......@@ -13,11 +13,11 @@ if __name__ == "__main__":
name = '.'
# choose action to do
choice = 0
while choice != 6:
while choice != 7:
if name == '.':
choice = 5
else :
choice = input("\n1 - Afficher les messages\n2 - Afficher les participants\n3 - Afficher les statistiques\n4 - Afficher les reactions\n5 - Changer de conversation\n6 - Quitter l\'application\n")
choice = input("\n1 - Afficher les messages\n2 - Afficher les participants\n3 - Afficher les statistiques\n4 - Afficher les reactions\n5 - Changer de conversation\n6 - Nombre de messages supprimés\n7 - Quitter l\'application\n")
try:
choice = int(choice)
except ValueError:
......@@ -42,3 +42,5 @@ if __name__ == "__main__":
os.chdir( originpath )
print( "Désolé, Conversation non trouvée." )
name = '.'
if choice == 6:
stats.countunset(data)
\ No newline at end of file
......@@ -50,3 +50,14 @@ def countreacts(data):
print(participants[participant][react], end=' ')
print("")
def countunset(data):
messages = data["messages"]
participants = users.userdico(data)
for participant in participants:
participants[participant] = 0
for msg in messages:
if msg["is_unsent"]:
participants[decode.string_decode(msg["sender_name"])] += 1
for nb_unsent in participants:
print(nb_unsent + " : " + str(participants[nb_unsent]))
import json
import os
def tri():
pass
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment