fix(SRC): :rocket: Return list and dict to after call to the function calculate stadistical data from list
Browse files- find_matches.py +9 -4
find_matches.py
CHANGED
@@ -91,6 +91,8 @@ def find_macros_that_match_dates_of_users(matches_dict, debug=False):
|
|
91 |
|
92 |
# Create a list to store the macros differences
|
93 |
macros_differences_dict = {}
|
|
|
|
|
94 |
macros_differences_dict_subir_macros = {
|
95 |
"costo subir macros": {
|
96 |
"date_of_match": "1990-01-01",
|
@@ -99,6 +101,7 @@ def find_macros_that_match_dates_of_users(matches_dict, debug=False):
|
|
99 |
"macros_difference": "0 20 0 0 0 0 20 0"
|
100 |
}
|
101 |
}
|
|
|
102 |
macros_differences_dict_bajar_macros = {
|
103 |
"costo bajar macros": {
|
104 |
"date_of_match": "1990-01-01",
|
@@ -111,15 +114,15 @@ def find_macros_that_match_dates_of_users(matches_dict, debug=False):
|
|
111 |
# If matches_dict is empty, then return empty list
|
112 |
if len(matches_dict) == 0:
|
113 |
print("[find_macros_that_match_dates_of_users] matches_dict is empty")
|
114 |
-
return
|
115 |
|
116 |
# If matches_dict is costo subir macros, then return empty list
|
117 |
if list(matches_dict.keys())[0] == 'costo subir macros':
|
118 |
print("[find_macros_that_match_dates_of_users] matches_dict is \"costo subir macros\"")
|
119 |
-
return macros_differences_dict_subir_macros
|
120 |
elif list(matches_dict.keys())[0] == 'costo bajar macros':
|
121 |
print("[find_macros_that_match_dates_of_users] matches_dict is \"costo bajar macros\"")
|
122 |
-
return macros_differences_dict_bajar_macros
|
123 |
|
124 |
# Iterate over the matches dictionary
|
125 |
for match_user in matches_dict:
|
@@ -154,6 +157,7 @@ def find_macros_that_match_dates_of_users(matches_dict, debug=False):
|
|
154 |
if type(macros_differences) == list:
|
155 |
if len(macros_differences) > 0:
|
156 |
for macros_difference in macros_differences:
|
|
|
157 |
days_between = get_days_between_dates(macros_differences_dates[i], date_of_match)
|
158 |
match_dict = {
|
159 |
"date_of_match": date_of_match,
|
@@ -165,6 +169,7 @@ def find_macros_that_match_dates_of_users(matches_dict, debug=False):
|
|
165 |
if debug: print(f"\tmacros_differences: {macros_difference}")
|
166 |
if debug: print("")
|
167 |
else:
|
|
|
168 |
if debug: print(f"\tmacros_differences: {macros_differences}\n")
|
169 |
match_dict = {
|
170 |
"date_of_macros_asignation": dates_that_match[0],
|
@@ -172,4 +177,4 @@ def find_macros_that_match_dates_of_users(matches_dict, debug=False):
|
|
172 |
}
|
173 |
macros_differences_dict[match_user] = match_dict
|
174 |
|
175 |
-
return macros_differences_dict
|
|
|
91 |
|
92 |
# Create a list to store the macros differences
|
93 |
macros_differences_dict = {}
|
94 |
+
macros_differences_list = []
|
95 |
+
macros_differences_list_subir_macros = ["0 20 0 0 0 0 20 0"]
|
96 |
macros_differences_dict_subir_macros = {
|
97 |
"costo subir macros": {
|
98 |
"date_of_match": "1990-01-01",
|
|
|
101 |
"macros_difference": "0 20 0 0 0 0 20 0"
|
102 |
}
|
103 |
}
|
104 |
+
macros_differences_list_bajar_macros = ["0 -20 0 0 0 0 -20 0"]
|
105 |
macros_differences_dict_bajar_macros = {
|
106 |
"costo bajar macros": {
|
107 |
"date_of_match": "1990-01-01",
|
|
|
114 |
# If matches_dict is empty, then return empty list
|
115 |
if len(matches_dict) == 0:
|
116 |
print("[find_macros_that_match_dates_of_users] matches_dict is empty")
|
117 |
+
return macros_differences_list, macros_differences_dict
|
118 |
|
119 |
# If matches_dict is costo subir macros, then return empty list
|
120 |
if list(matches_dict.keys())[0] == 'costo subir macros':
|
121 |
print("[find_macros_that_match_dates_of_users] matches_dict is \"costo subir macros\"")
|
122 |
+
return macros_differences_list_subir_macros, macros_differences_dict_subir_macros
|
123 |
elif list(matches_dict.keys())[0] == 'costo bajar macros':
|
124 |
print("[find_macros_that_match_dates_of_users] matches_dict is \"costo bajar macros\"")
|
125 |
+
return macros_differences_list_bajar_macros, macros_differences_dict_bajar_macros
|
126 |
|
127 |
# Iterate over the matches dictionary
|
128 |
for match_user in matches_dict:
|
|
|
157 |
if type(macros_differences) == list:
|
158 |
if len(macros_differences) > 0:
|
159 |
for macros_difference in macros_differences:
|
160 |
+
macros_differences_list.append(macros_difference)
|
161 |
days_between = get_days_between_dates(macros_differences_dates[i], date_of_match)
|
162 |
match_dict = {
|
163 |
"date_of_match": date_of_match,
|
|
|
169 |
if debug: print(f"\tmacros_differences: {macros_difference}")
|
170 |
if debug: print("")
|
171 |
else:
|
172 |
+
macros_differences_list.append(macros_differences)
|
173 |
if debug: print(f"\tmacros_differences: {macros_differences}\n")
|
174 |
match_dict = {
|
175 |
"date_of_macros_asignation": dates_that_match[0],
|
|
|
177 |
}
|
178 |
macros_differences_dict[match_user] = match_dict
|
179 |
|
180 |
+
return macros_differences_list, macros_differences_dict
|