Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Florestan Biaux
Messenger Statistics
Commits
b1e850db
Commit
b1e850db
authored
Jul 21, 2021
by
Florestan Biaux
💬
Browse files
ajout de la stat nombre de messages envoyés
parent
a1a0ecb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
main.py
View file @
b1e850db
...
...
@@ -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
(
"
\n
1 - Afficher les messages
\n
2 - Afficher les participants
\n
3 - Quitter l
\'
application
\n
"
))
while
choice
!=
4
:
choice
=
int
(
input
(
"
\n
1 - Afficher les messages
\n
2 - Afficher les participants
\n
3 -
Afficher les statistiques
\n
4 -
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
)
stats.py
0 → 100644
View file @
b1e850db
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment