- Fix generate.sh

- Add log in generate_chat_info.py
This commit is contained in:
Mickael 2019-08-17 17:43:25 +02:00
parent 4bac49679a
commit 0c50498f88
3 changed files with 7 additions and 5 deletions

View file

@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
pip3 install -r requirements.txt pip3 install -r ./scripts/requirements.txt
# idees # idees
cp ./site/data/idees.sample.json ./site/data/idees.json cp ./site/data/idees.sample.json ./site/data/idees.json
# chat # chat
python3 ./script/generate_chat_info.py python3 ./scripts/generate_chat_info.py
# wiki # wiki

View file

@ -6,6 +6,8 @@ from datetime import datetime
from monthdelta import monthdelta from monthdelta import monthdelta
def main(): def main():
print("Start chat info generation")
crapauds_total = 0 crapauds_total = 0
crapauds_recent = 0 crapauds_recent = 0
channels_total = 0 channels_total = 0
@ -37,7 +39,6 @@ def main():
channels_list.append(channel["name"]) channels_list.append(channel["name"])
messages = rocket.channels_history(channel["_id"], oldest= recent_date, count= 10000).json() messages = rocket.channels_history(channel["_id"], oldest= recent_date, count= 10000).json()
messages_recent += len(messages["messages"]) messages_recent += len(messages["messages"])
info = { info = {
"crapauds": { "crapauds": {
@ -56,6 +57,7 @@ def main():
} }
save(info) save(info)
print("End chat info generation")
def save(info): def save(info):
# Récupération du répertoire racine du repo # Récupération du répertoire racine du repo

View file

@ -1 +1 @@
{"crapauds": {"total": 2363, "recent": 85}, "canaux": {"total": 176, "recent": 10, "liste": ["activite-et-travail", "bnb-bonheur-national-brut", "cohorte-barcelone", "cohorte-lyon-st-etienne", "crapomobile", "dessins-citoyens-collectifs-booderies", "emmaus-pau-lescar", "empowerment", "projet-cand-alterincub-centre", "terre-de-convergence"]}, "messages": {"total": 185199, "recent": 1108}} {"crapauds": {"total": 2363, "recent": 85}, "canaux": {"total": 176, "recent": 10, "liste": ["activite-et-travail", "bnb-bonheur-national-brut", "cohorte-barcelone", "cohorte-lyon-st-etienne", "crapomobile", "dessins-citoyens-collectifs-booderies", "emmaus-pau-lescar", "empowerment", "projet-cand-alterincub-centre", "terre-de-convergence"]}, "messages": {"total": 185200, "recent": 1108}}