Commit b1e850db authored by Florestan Biaux's avatar Florestan Biaux 💬
Browse files

ajout de la stat nombre de messages envoyés

parent a1a0ecb6
......@@ -3,6 +3,7 @@ import get
import users
import json
import decode
import stats
if __name__ == "__main__":
......@@ -12,9 +13,11 @@ if __name__ == "__main__":
data = get.getfile(name) # data = json
# choose action to do
choice = 0
while choice != 3:
choice = int(input("\n1 - Afficher les messages\n2 - Afficher les participants\n3 - Quitter l\'application\n"))
while choice != 4:
choice = int(input("\n1 - Afficher les messages\n2 - Afficher les participants\n3 - Afficher les statistiques\n4 - Quitter l\'application\n"))
if choice == 1:
print(data)
if choice == 2:
print(users.usertab(data))
if choice == 3:
stats.counttalk(users.usertab(data), data)
import decode
def counttalk(usertab, data):
tmp = ""
print(len(usertab))
print("\n")
for i in range(len(usertab)):
tmp = tmp + "0 "
tmp = tmp.split()
counttalk = [usertab, tmp]
messages = data["messages"]
for msg in messages:
for i in range(len(counttalk[0])):
if decode.string_decode(msg["sender_name"]) == counttalk[0][i]:
counttalk[1][i] = int(counttalk[1][i])+1
print(counttalk)
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