Remove some debugging code
This commit is contained in:
parent
e90c151787
commit
9774da0d00
|
@ -132,7 +132,6 @@ def query_results(
|
||||||
required_any = ["query_full", "query", "tags"]
|
required_any = ["query_full", "query", "tags"]
|
||||||
if not any([field in query_params.keys() for field in required_any]):
|
if not any([field in query_params.keys() for field in required_any]):
|
||||||
if not custom_query:
|
if not custom_query:
|
||||||
print("EMPTY QUERY")
|
|
||||||
message = "Empty query!"
|
message = "Empty query!"
|
||||||
message_class = "warning"
|
message_class = "warning"
|
||||||
return {"message": message, "class": message_class}
|
return {"message": message, "class": message_class}
|
||||||
|
@ -162,12 +161,10 @@ def query_results(
|
||||||
for source_iter in settings.MANTICORE_SOURCES_RESTRICTED:
|
for source_iter in settings.MANTICORE_SOURCES_RESTRICTED:
|
||||||
sources.append(source_iter)
|
sources.append(source_iter)
|
||||||
|
|
||||||
print("BEOFRE ADD TOP", add_top)
|
|
||||||
add_top_tmp = {"bool": {"should": []}}
|
add_top_tmp = {"bool": {"should": []}}
|
||||||
for source_iter in sources:
|
for source_iter in sources:
|
||||||
add_top_tmp["bool"]["should"].append({"equals": {"src": source_iter}})
|
add_top_tmp["bool"]["should"].append({"equals": {"src": source_iter}})
|
||||||
add_top.append(add_top_tmp)
|
add_top.append(add_top_tmp)
|
||||||
print("AFTER", add_top)
|
|
||||||
|
|
||||||
# Date/time range
|
# Date/time range
|
||||||
if set({"from_date", "to_date", "from_time", "to_time"}).issubset(
|
if set({"from_date", "to_date", "from_time", "to_time"}).issubset(
|
||||||
|
@ -292,5 +289,4 @@ def query_results(
|
||||||
"card": results["hits"]["total"],
|
"card": results["hits"]["total"],
|
||||||
"took": results["took"],
|
"took": results["took"],
|
||||||
}
|
}
|
||||||
print("RTRN", context)
|
|
||||||
return context
|
return context
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
from core.lib.threshold import annotate_num_chans, annotate_num_users, annotate_online
|
|
||||||
from django.conf import settings
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
from core.lib.threshold import annotate_num_chans, annotate_num_users, annotate_online
|
||||||
|
|
||||||
|
|
||||||
def annotate_results(results_parsed):
|
def annotate_results(results_parsed):
|
||||||
"""
|
"""
|
||||||
|
@ -147,7 +149,9 @@ def parse_results(results):
|
||||||
if isinstance(element["ts"], str):
|
if isinstance(element["ts"], str):
|
||||||
ts = element["ts"]
|
ts = element["ts"]
|
||||||
else:
|
else:
|
||||||
ts = datetime.utcfromtimestamp(element["ts"]).strftime('%Y-%m-%dT%H:%M:%S')
|
ts = datetime.utcfromtimestamp(element["ts"]).strftime(
|
||||||
|
"%Y-%m-%dT%H:%M:%S"
|
||||||
|
)
|
||||||
ts_spl = ts.split("T")
|
ts_spl = ts.split("T")
|
||||||
date = ts_spl[0]
|
date = ts_spl[0]
|
||||||
time = ts_spl[1]
|
time = ts_spl[1]
|
||||||
|
@ -161,4 +165,4 @@ def parse_results(results):
|
||||||
else:
|
else:
|
||||||
element["time"] = time
|
element["time"] = time
|
||||||
results_parsed.append(element)
|
results_parsed.append(element)
|
||||||
return results_parsed
|
return results_parsed
|
||||||
|
|
|
@ -406,7 +406,6 @@ class DrilldownContextModal(APIView):
|
||||||
# for index, item in enumerate(results["object_list"]):
|
# for index, item in enumerate(results["object_list"]):
|
||||||
# results["object_list"][index]["time"] = item["time"]+"SSS"
|
# results["object_list"][index]["time"] = item["time"]+"SSS"
|
||||||
unique = str(uuid.uuid4())[:8]
|
unique = str(uuid.uuid4())[:8]
|
||||||
print("PARAMS", query_params)
|
|
||||||
context = {
|
context = {
|
||||||
"net": query_params["net"],
|
"net": query_params["net"],
|
||||||
"channel": query_params["channel"],
|
"channel": query_params["channel"],
|
||||||
|
|
Loading…
Reference in New Issue