diff --git a/flask_soc_site/__init__.py b/flask_soc_site/__init__.py index 2b51f12..154f677 100644 --- a/flask_soc_site/__init__.py +++ b/flask_soc_site/__init__.py @@ -55,6 +55,7 @@ def create_app(test_config=None): ### TESTING build_history(results) + print("build_history just ran...") # session["results"] = pickle.dumps(results) # if "history" in session: # print("HISTORY IS IN SESSION") @@ -91,12 +92,23 @@ def create_app(test_config=None): return results def build_history(results): + current_history = [] if "history" in session: current_history = pickle.loads(session["history"]) + updated_history = current_history for result in results: - if result.host not in current_history: - current_history.append(result) - session["history"] = pickle.dumps(current_history) + for item in current_history: + if result.host == item.host: + print(f"{result.host} and {item.host} are the same") + else: + updated_history.append(result) + # if result not in current_history: + # current_history.append(result) + # print(f"{result} not in {current_history}") + # elif result in current_history: + # print(f"{result} is in {current_history}") + # session["history"] = pickle.dumps(current_history) + session["history"] = pickle.dumps(updated_history) elif "history" not in session: session["history"] = pickle.dumps(results)