Commit 3ca272b5 authored by Alexander Lercher's avatar Alexander Lercher

Fixed syntax errors

parent 31679a46
......@@ -97,14 +97,4 @@ class Repository(MongoRepositoryBase):
projection={'_id': 0})
return list(entries)
# #TODO redundant?
# def get_nodes_from_ids(self, unique_id_list: List) -> List[str]:
# result = list(super().get_entries(self._transaction_collection, projection={'_id': False}, selection={"UniqueID": { "$in": unique_id_list}}))
# if len(result) > 0:
# return result
# return []
# endregion
......@@ -83,7 +83,7 @@ class MessageHandler:
return
nodes = []
unique_id_list = []
for layer in layers:
node = {}
......@@ -95,16 +95,7 @@ class MessageHandler:
node["table"] = layer.table
node["use_case"] = layer.use_case
nodes.append(node)
unique_id_list.append(node["UniqueID"])
#TODO redundant if we already check in trace?
# nodes_in_db = self._repository.get_nodes_from_ids(unique_id_list)
# if len(nodes_in_db) > 0: #found duplicates
# #remove duplicates from nodes:
# for node in nodes:
# if node["UniqueID"] in nodes_in_db:
# nodes.remove(node)
if len(nodes) > 0:
self._repository.add_layer_nodes(nodes)
......
......@@ -37,27 +37,8 @@ class DummyMongoRepo:
def add_layer_nodes(self, nodes: List):
self.layernodes.extend(nodes)
return
def get_nodes_from_ids(self, unique_id_list)
retList = []
for node in layernodes:
# layers = self._repository.get_layers_for_use_case_and_table(use_case, table)
## if no local layers are found, fetch information from server
# if len(layers) == 0:
# layers = self._fetch_layer_information(use_case, table)
# self._repository.delete_layer(layer)
# self._repository.add_layer(layer)
#TODO
# nodes_in_db = self._repository.get_nodes_from_ids(unique_id_list)
class Test_Pipeline(unittest.TestCase):
handler = None
repo = None
......
......@@ -18,7 +18,7 @@ class Repository(MongoRepositoryBase):
self._transaction_collection = 'transactions'
self._failed_transaction_collection = 'transactions_failed'
self._duplicated_transactioN_collection = "transactions_duplicated"
self._duplicated_transaction_collection = "transactions_duplicated"
def delete_all_transactions(self):
collection = self._database[self._transaction_collection]
......@@ -62,12 +62,12 @@ class Repository(MongoRepositoryBase):
def add_duplicated_transaction(self, transaction: Transaction):
#transaction["timestamp"] = time.time()
super().insert_entry(self._duplicated_transactioN_collection, transaction.to_serializable_dict())
super().insert_entry(self._duplicated_transaction_collection, transaction.to_serializable_dict())
def all_duplicated_transactions_for_use_case(self, use_case: str) -> List[Dict]:
result = super().get_entries(self._duplicated_transaction_collection, projection={'_id': False}, selection={"use_case": use_case})
return [Transaction.from_serializable_dict(row) for row in list(result)]
def delete_all_duplicated_transactions(self, use_case:str):
collection = self._database[self._duplicated_transactioN_collection]
collection = self._database[self._duplicated_transaction_collection]
collection.delete_many({"ApplicationType": use_case})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment