diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 36b17a6..383f0ae 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,10 +1,10 @@ - + - + @@ -460,7 +460,6 @@ - @@ -485,6 +484,7 @@ - \ No newline at end of file diff --git a/Log/log_file.log b/Log/log_file.log index f7a2628..2b13dc1 100644 --- a/Log/log_file.log +++ b/Log/log_file.log @@ -2551147,3 +2551147,386 @@ INFO:root:2024-07-05 15:05:47.648889 : ++ FLASK PORT 5001 ++ INFO:root:2024-07-05 15:05:47.648889 : ++ LMS_BAS_URL mysy-training.com/ ++ WARNING:werkzeug: * Debugger is active! INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:root:2024-07-05 15:06:37.632487 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [05/Jul/2024 15:06:37] "POST /myclass/api/Get_List_Formulaire/ HTTP/1.1" 200 - +INFO:root:2024-07-07 14:06:19.095703 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:06:19.096701 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:06:19.096701 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:06:19.096701 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:06:19.096701 : ++ LMS_BAS_URL mysy-training.com/ ++ +INFO:werkzeug:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on http://localhost:5001 +INFO:werkzeug:Press CTRL+C to quit +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:06:31.519064 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:06:31.520060 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:06:31.520060 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:06:31.520060 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:06:31.520060 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:08:24.630661 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:08:24.631661 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:08:24.631661 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:08:24.631661 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:08:24.631661 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:10:38.358925 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:10:38.358925 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:10:38.359930 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:10:38.359930 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:10:38.360932 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:11:14.511164 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:11:14.511164 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:11:14.511164 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:11:14.512191 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:11:14.512191 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:12:16.188518 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:12:16.189514 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:12:16.189514 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:12:16.189514 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:12:16.190512 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:18:10.687837 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:18:10.687837 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:18:10.687837 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:18:10.687837 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:18:10.687837 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:19:09.686796 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:19:09.687825 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:19:09.687825 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:19:09.687825 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:19:09.687825 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:48:01.386135 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:48:01.386135 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:48:01.386135 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:48:01.386135 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:48:01.386135 : ++ LMS_BAS_URL mysy-training.com/ ++ +INFO:werkzeug:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on http://localhost:5001 +INFO:werkzeug:Press CTRL+C to quit +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:48:13.407096 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:48:13.407096 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:48:13.407096 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:48:13.407096 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:48:13.407096 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:root:2024-07-07 14:50:21.611302 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2024-07-07 14:50:22.533910 : Get_Survey_Stat_Data_For_Given_related_collection_id -time data '' does not match format '%d/%m/%Y' - Line : 2319 +INFO:werkzeug:127.0.0.1 - - [07/Jul/2024 14:50:22] "POST /myclass/api/Get_Survey_Stat_Data_For_Given_related_collection_id/ HTTP/1.1" 200 - +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:53:03.209511 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:53:03.213600 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:53:03.213600 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:53:03.213600 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:53:03.213600 : ++ LMS_BAS_URL mysy-training.com/ ++ +INFO:werkzeug:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on http://localhost:5001 +INFO:werkzeug:Press CTRL+C to quit +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:53:15.159794 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:53:15.159794 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:53:15.159794 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:53:15.159794 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:53:15.159794 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:root:2024-07-07 14:55:07.573679 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2024-07-07 14:55:08.518164 : Get_Survey_Stat_Data_For_Given_related_collection_id -local variable 'filt_periode_start_date_ISODATE' referenced before assignment - Line : 2329 +INFO:werkzeug:127.0.0.1 - - [07/Jul/2024 14:55:08] "POST /myclass/api/Get_Survey_Stat_Data_For_Given_related_collection_id/ HTTP/1.1" 200 - +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:56:42.032847 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:56:42.032847 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:56:42.032847 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:56:42.032847 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:56:42.032847 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:56:59.628762 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:56:59.628762 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:56:59.628762 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:56:59.628762 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:56:59.628762 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:root:2024-07-07 14:57:25.152248 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jul/2024 14:57:25] "POST /myclass/api/Get_Survey_Stat_Data_For_Given_related_collection_id/ HTTP/1.1" 200 - +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 14:59:03.178237 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 14:59:03.178237 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 14:59:03.178237 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 14:59:03.178237 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 14:59:03.179243 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:root:2024-07-07 14:59:11.073254 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jul/2024 14:59:11] "POST /myclass/api/Get_Survey_Stat_Data_For_Given_related_collection_id/ HTTP/1.1" 200 - +INFO:root:2024-07-07 14:59:19.155632 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jul/2024 14:59:19] "POST /myclass/api/Get_Survey_Stat_Data_For_Given_related_collection_id/ HTTP/1.1" 200 - +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:00:09.113004 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:00:09.113004 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:00:09.113004 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:00:09.113004 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:00:09.113004 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:00:30.890311 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:00:30.890311 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:00:30.890311 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:00:30.890311 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:00:30.890311 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:00:51.534392 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:00:51.534392 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:00:51.534392 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:00:51.534392 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:00:51.534392 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:01:28.486234 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:01:28.487238 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:01:28.487238 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:01:28.487238 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:01:28.487238 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:02:11.363841 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:02:11.363841 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:02:11.363841 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:02:11.363841 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:02:11.363841 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:02:29.987992 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:02:29.988994 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:02:29.988994 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:02:29.988994 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:02:29.988994 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:03:08.337258 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:03:08.338258 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:03:08.338258 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:03:08.338258 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:03:08.338258 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:03:29.475481 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:03:29.475481 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:03:29.475481 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:03:29.475481 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:03:29.476474 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:04:28.382175 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:04:28.382712 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:04:28.382712 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:04:28.382712 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:04:28.382712 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:root:2024-07-07 15:04:28.436970 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jul/2024 15:04:28] "POST /myclass/api/Get_Survey_Stat_Data_For_Given_related_collection_id/ HTTP/1.1" 200 - +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:06:36.437872 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:06:36.437872 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:06:36.437872 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:06:36.437872 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:06:36.437872 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:07:45.655276 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:07:45.656281 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:07:45.656281 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:07:45.656281 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:07:45.656281 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:08:14.590509 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:08:14.590509 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:08:14.590509 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:08:14.590509 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:08:14.590509 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:08:47.398142 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:08:47.398142 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:08:47.398142 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:08:47.398142 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:08:47.398142 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:09:35.229937 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:09:35.229937 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:09:35.229937 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:09:35.229937 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:09:35.229937 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:11:57.646146 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:11:57.646146 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:11:57.647147 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:11:57.647147 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:11:57.647147 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:14:36.877324 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:14:36.877324 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:14:36.877324 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:14:36.877324 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:14:36.877324 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:14:56.298837 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:14:56.298837 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:14:56.298837 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:14:56.298837 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:14:56.298837 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:16:36.091144 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:16:36.091144 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:16:36.091144 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:16:36.091144 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:16:36.091144 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:17:56.729157 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:17:56.730664 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:17:56.730664 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:17:56.730664 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:17:56.730664 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:root:2024-07-07 15:18:24.945065 : Security check : IP adresse '127.0.0.1' connected +INFO:root:2024-07-07 15:18:25.734975 : Get_Survey_Stat_Data_For_Given_related_collection_id -division by zero - Line : 2409 +INFO:werkzeug:127.0.0.1 - - [07/Jul/2024 15:18:25] "POST /myclass/api/Get_Survey_Stat_Data_For_Given_related_collection_id/ HTTP/1.1" 200 - +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:19:36.755515 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:19:36.755515 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:19:36.755515 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:19:36.755515 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:19:36.755515 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:root:2024-07-07 15:19:36.809596 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jul/2024 15:19:36] "POST /myclass/api/Get_Survey_Stat_Data_For_Given_related_collection_id/ HTTP/1.1" 200 - +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:22:05.663209 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:22:05.663209 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:22:05.664444 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:22:05.664444 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:22:05.664444 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:22:40.833288 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:22:40.834272 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:22:40.834272 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:22:40.834272 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:22:40.834272 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:23:05.575637 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:23:05.575637 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:23:05.575637 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:23:05.575637 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:23:05.575637 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:27:45.937518 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:27:45.937518 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:27:45.937518 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:27:45.937518 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:27:45.937518 : ++ LMS_BAS_URL mysy-training.com/ ++ +INFO:werkzeug:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. + * Running on http://localhost:5001 +INFO:werkzeug:Press CTRL+C to quit +INFO:werkzeug: * Restarting with stat +INFO:root:2024-07-07 15:27:58.422941 : ++++ ENVIRONNEMENT DEVELOPPEMENT ++++ +INFO:root:2024-07-07 15:27:58.422941 : ++ DATABASE mongodb://localhost:27017/cherifdb_dev ++ +INFO:root:2024-07-07 15:27:58.422941 : ++ DBNAME Database(MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True), 'cherifdb_dev') ++ +INFO:root:2024-07-07 15:27:58.422941 : ++ FLASK PORT 5001 ++ +INFO:root:2024-07-07 15:27:58.422941 : ++ LMS_BAS_URL mysy-training.com/ ++ +WARNING:werkzeug: * Debugger is active! +INFO:werkzeug: * Debugger PIN: 877-541-979 +INFO:root:2024-07-07 15:27:58.479804 : Security check : IP adresse '127.0.0.1' connected +INFO:werkzeug:127.0.0.1 - - [07/Jul/2024 15:27:58] "POST /myclass/api/Get_Survey_Stat_Data_For_Given_related_collection_id/ HTTP/1.1" 200 - +INFO:werkzeug: * Detected change in 'C:\\Users\\billa\\Documents\\myclass.com\\Siteweb\\Production\\Ela_back\\Back_Office\\survey_mgt.py', reloading +INFO:werkzeug: * Restarting with stat diff --git a/main.py b/main.py index 5b07634..ab134dd 100644 --- a/main.py +++ b/main.py @@ -10174,6 +10174,21 @@ def Delete_Inscription_Split_Invoice(): +""" +API permet de faire des statistiques ou de projections graphiques sur +sur des reponses, par exemple la moyenne de satisfaction par rapport +a un formateur ou par rapport à une formation +""" +@app.route('/myclass/api/Get_Survey_Stat_Data_For_Given_related_collection_id/', methods=['POST','GET']) +@crossdomain(origin='*') +def Get_Survey_Stat_Data_For_Given_related_collection_id(): + # On recupere le corps (payload) de la requete + payload = mycommon.strip_dictionary (request.form.to_dict()) + print(" ### Get_Survey_Stat_Data_For_Given_related_collection_id payload = ",payload) + status, retval = survey_mgt.Get_Survey_Stat_Data_For_Given_related_collection_id(payload) + return jsonify(status=status, message=retval) + + if __name__ == '__main__': print(" debut api") diff --git a/survey_mgt.py b/survey_mgt.py index a9ff055..d4c0e84 100644 --- a/survey_mgt.py +++ b/survey_mgt.py @@ -7,6 +7,7 @@ import ast import bson import pymongo import xlsxwriter +from dateutil.relativedelta import relativedelta from pymongo import MongoClient import json from bson import ObjectId @@ -2210,3 +2211,227 @@ def Export_To_Excel_Survey_with_filter(diction): return False, " Impossible de générer l'export " +""" +cette fonction permet de faire des statistiques ou de projections graphiques sur +sur des reponses, par exemple la moyenne de satisfaction par rapport +a un formateur ou par rapport à une formation +""" +def Get_Survey_Stat_Data_For_Given_related_collection_id(diction): + try: + diction = mycommon.strip_dictionary(diction) + + """ + Verification des input acceptés + """ + field_list = ['token', 'periode_start_date', 'periode_end_date', 'related_collection', 'related_collection_id', + 'question_id'] + + incom_keys = diction.keys() + for val in incom_keys: + if val not in field_list and val.startswith('my_') is False: + mycommon.myprint(str( + inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé") + return False, " Les informations fournies sont incorrectes" + + """ + Verification des champs obligatoires + """ + field_list_obligatoire = ['token', 'related_collection', 'related_collection_id', 'question_id', + 'periode_start_date', 'periode_end_date',] + + for val in field_list_obligatoire: + if val not in diction: + mycommon.myprint( + str(inspect.stack()[0][3]) + " - La valeur '" + val + "' n'est pas presente dans liste ") + return False, " Les informations fournies sont incorrectes" + + """ + Verification de l'identité et autorisation de l'entité qui + appelle cette API + """ + token = "" + if ("token" in diction.keys()): + if diction['token']: + token = diction['token'] + + local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data(diction) + if (local_status is not True): + return local_status, my_partner + + """ + Recuperer les données de la quesion + """ + is_question_formulaire_exist = MYSY_GV.dbname['formulaire'].count_documents( + {'partner_owner_recid': str(my_partner['recid']), + 'valide': '1', 'locked': '0', + 'list_questions._id': str(diction['question_id'])}) + + if (is_question_formulaire_exist != 1): + mycommon.myprint(" L'identifiant de la question est invalide ") + return False, " L'identifiant de la question est invalide " + + is_question_formulaire = MYSY_GV.dbname['formulaire'].find_one( + {'partner_owner_recid': str(my_partner['recid']), + 'valide': '1', 'locked': '0', + 'list_questions._id': str(diction['question_id'])}) + + is_question_data = None + for tmp in is_question_formulaire['list_questions']: + if( tmp['_id'] == str(diction['question_id'])): + is_question_data = tmp + + if( is_question_data is None ): + mycommon.myprint(" L'identifiant de la question est invalide (2) ") + return False, " L'identifiant de la question est invalide (2) " + + if( "is_statistic" not in is_question_data.keys() or str(is_question_data['is_statistic']) != "1"): + mycommon.myprint(" La question n'est pas soumises à une analyse statistique ") + return False, " La question n'est pas soumises à une analyse statistique " + + + question_analyse_type = "" + if( is_question_data['type'] in ['note', 'entier']): + question_analyse_type = "moyenne" + + elif (is_question_data['type'] in ['bool']): + question_analyse_type = "somme" + else : + mycommon.myprint(" Le paramétrage de la question ne permet pas de déterminer la nature statistiques des données ") + return False, " Le paramétrage de la question ne permet pas de déterminer la nature statistiques des données " + + + """ + Si on a des dates, 'date_from', 'date_to', verifier qu'elles sont valides + """ + + filt_periode_start_date = "" + if ("periode_start_date" in diction.keys() and diction['periode_start_date']): + filt_periode_start_date = str(diction['periode_start_date'])[0:10] + local_status = mycommon.CheckisDate(filt_periode_start_date) + if (local_status is False): + mycommon.myprint(str( + inspect.stack()[0][3]) + " Le filtre : 'date de debut' n'est pas au format jj/mm/aaaa.") + return False, " Le filtre : 'date de debut' n'est pas au format jj/mm/aaaa." + + filt_periode_end_date = "" + if ("periode_end_date" in diction.keys() and diction['periode_end_date']): + filt_periode_end_date = str(diction['periode_end_date'])[0:10] + local_status = mycommon.CheckisDate(filt_periode_end_date) + if (local_status is False): + mycommon.myprint(str( + inspect.stack()[0][3]) + " Le filtre : 'date de fin' n'est pas au format jj/mm/aaaa.") + return False, " Le filtre : 'date de fin' n'est pas au format jj/mm/aaaa." + + if( filt_periode_start_date and filt_periode_end_date ): + filt_periode_start_date_ISODATE = datetime.strptime(str(filt_periode_start_date), '%d/%m/%Y') + filt_periode_end_date_ISODATE = datetime.strptime(str(filt_periode_end_date), '%d/%m/%Y') + else: + mycommon.myprint(str( + inspect.stack()[0][3]) + " Les filtred : les dates de debut et fin ne sont pas valides.") + return False, " Les filtred : les dates de debut et fin ne sont pas valides." + + """ + Creation de la range des mois entre filt_periode_start_date_ISODATE et + filt_periode_end_date_ISODATE + """ + range_date_month = [] + start = filt_periode_start_date_ISODATE + end = filt_periode_end_date_ISODATE + while start <= end: + node = {} + node['month_year'] = '{:02d}'.format(start.month) + "_" + str(start.year) + node['label'] = '{:02d}'.format(start.month) + "_" + str(start.year) + node['TotalAmount'] = 0 + node['value'] = 0 + node['count'] = 0 + + range_date_month.append(node) + start += relativedelta(months=1) + + #print(" ### range_date_month = ", range_date_month) + qery_match = {'$and': [{"partner_owner_recid": str(my_partner['recid'])}, + {"valide": '1', 'locked':'0', 'statut':'2', + "date_reponse": {"$exists": True}, + 'user_response.question_id': str(diction['question_id']), + 'related_collection':str(diction['related_collection']), + 'related_collection_id': str(diction['related_collection_id']), + }, + + { + 'mysy_survey_date_reponse': {'$gte': filt_periode_start_date_ISODATE, + '$lte': filt_periode_end_date_ISODATE}}, ]} + + pipe_qry = ([ + {"$addFields": { + "mysy_survey_date_reponse": { + '$dateFromString': { + 'dateString': { '$substr': [ "$date_reponse", 0, 10 ] }, + 'format': "%Y-%m-%d" + } + } + } + }, + + {'$match': qery_match}, + + ]) + + #print(" ### Get_Survey_Stat_Data ici pipe_qry = ", pipe_qry) + RetObject = [] + val_tmp = 0 + + raw_reponse_data = [] + + for retval in MYSY_GV.dbname['survey'].aggregate(pipe_qry): + for tmp in retval['user_response']: + if (tmp['question_id'] == str(diction['question_id'])): + node = {} + node['related_collection'] = str(diction['related_collection']) + node['related_collection_id'] = str(diction['related_collection_id']) + node['question_id'] = str(diction['question_id']) + node['question_question'] = str(is_question_data['question']) + node['question_type'] = str(is_question_data['type']) + node['question_response'] = str(tmp['response']) + node['question_date_reponse'] = str(retval['date_reponse']) + node['question_date_reponse_mois_annee'] = str(retval['date_reponse'])[5:7]+"_"+str(retval['date_reponse'])[0:4] + raw_reponse_data.append(node) + + + #print(" ### les reponses brutes sont : ", raw_reponse_data) + + for tmp in range_date_month: + nb_question_response = 0 + somme_question_response = 0 + + for local_data in raw_reponse_data: + if (str(local_data['question_date_reponse_mois_annee']) == str(tmp['month_year'])): + nb_question_response = nb_question_response + 1 + somme_question_response = somme_question_response + mycommon.tryFloat(str(local_data['question_response'])) + + if( nb_question_response > 0 ): + moyenne_question_response = round(somme_question_response / nb_question_response, 2) + + tmp['nb_question_response'] = str(nb_question_response) + tmp['somme_question_response'] = str(somme_question_response) + tmp['moyenne_question_response'] = str(moyenne_question_response) + + tmp['count'] = str(nb_question_response) + if( str(question_analyse_type) == "moyenne"): + tmp['value'] = str(moyenne_question_response) + elif( str(question_analyse_type) == "somme"): + tmp['value'] = str(somme_question_response) + + else: + tmp['nb_question_response'] = "0" + tmp['somme_question_response'] = "0" + tmp['moyenne_question_response'] = "0" + tmp['count'] = "0" + tmp['value'] = "0" + + print(" ### les reponses range_date_month: ", range_date_month) + + return True, range_date_month + except Exception as e: + exc_type, exc_obj, exc_tb = sys.exc_info() + mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno)) + return False, " Impossible de récupérer les données statistiques "