Introduced is comparison to applyConditions to fo boolean value filtering
This commit is contained in:
@@ -47,6 +47,11 @@ def applyConditions(definition, dictionary, outputs):
|
||||
print(filter["print"])
|
||||
return True, filter
|
||||
|
||||
if filter["operator"] == "is":
|
||||
if resolvedvalue is filtervalue:
|
||||
print(filter["print"])
|
||||
return True, filter
|
||||
|
||||
except KeyError:
|
||||
print(f"Value not present in runtime for filtering during {definition.name}")
|
||||
#print(filter)
|
||||
|
||||
@@ -19,6 +19,10 @@ resolve = {
|
||||
{"resolved": "sender"},
|
||||
":loxthelion.com",
|
||||
],
|
||||
"matrixdm": [
|
||||
"rmass_dm_",
|
||||
{"resolved": "sender"},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
@@ -65,11 +69,41 @@ headers = {
|
||||
#}
|
||||
|
||||
filters = [
|
||||
# {
|
||||
# "filterkey": "avatar_hash",
|
||||
# "operator": "==",
|
||||
# "filtervalue": {"outputs": "db_avatar_hash"},
|
||||
# "print": f"User avatar up to date. Skipping {name}...",
|
||||
# },
|
||||
{
|
||||
"filterkey": "avatar_hash",
|
||||
"operator": "==",
|
||||
"filtervalue": {"outputs": "db_avatar_hash"},
|
||||
"print": f"User avatar up to date. Skipping {name}...",
|
||||
"filterkey": "uploadimage",
|
||||
"operator": "is",
|
||||
"filtervalue": None,
|
||||
"print": f"No avatar for upload. Skipping {name}...",
|
||||
},
|
||||
]
|
||||
|
||||
#saverow = {
|
||||
# "table": "user_profiles",
|
||||
# "columns": [
|
||||
# {"rmass_user_id": "INTEGER PRIMARY KEY"},
|
||||
# {"rmass_username": "TEXT NOT NULL UNIQUE"},
|
||||
# {"rmass_dm_room": "TEXT NOT NULL UNIQUE"},
|
||||
# {"rmass_avatar_hash": "TEXT"},
|
||||
# ],
|
||||
# "rowitems": [
|
||||
# {"resolved": "sender"},
|
||||
# {"resolved": "username"},
|
||||
# {"resolved": "matrixdm"},
|
||||
# {"outputs": "useravatar_hash"},
|
||||
# ],
|
||||
# "onconflict": {
|
||||
# "target": "rmass_user_id",
|
||||
# "update": [
|
||||
# "rmass_username",
|
||||
# "rmass_dm_room",
|
||||
# "rmass_avatar_hash",
|
||||
# ],
|
||||
# "preservenull": True,
|
||||
# },
|
||||
#}
|
||||
@@ -17,8 +17,9 @@ resolve = {
|
||||
"sender": ["messageitem", "senderId"],
|
||||
"message_id": ["messageitem", "id"],
|
||||
"message_body": ["messageitem", "text"],
|
||||
"room_id": ["dmroom_id"],
|
||||
"room_id": ["room_id"],
|
||||
"timestamp": ["messageitem", "createdAt"],
|
||||
#"attachments": ["messageitem", "attachments"]
|
||||
},
|
||||
"construct": {
|
||||
"matrixuser": [
|
||||
@@ -114,7 +115,6 @@ readrow = {
|
||||
"rowsearchvalue": [
|
||||
{"resolved": "message_id"},
|
||||
],
|
||||
"columnnumber": 0,
|
||||
"export": {
|
||||
0: "db_message_id",
|
||||
}
|
||||
@@ -127,5 +127,18 @@ filters = [
|
||||
"filtervalue": {"outputs": "db_message_id"},
|
||||
"print": "Message already forwarded. Continuing...",
|
||||
},
|
||||
]
|
||||
|
||||
## To be uncommented once getrmassattachments is introduced
|
||||
# {
|
||||
# "filterkey": "attachments",
|
||||
# "operator": "is not",
|
||||
# "filtervalue": None,
|
||||
# "print": "Getting message attachments...",
|
||||
# "execute": "getrmassattachments"
|
||||
# },
|
||||
{
|
||||
"filterkey": "room_id",
|
||||
"operator": "is",
|
||||
"filtervalue": None,
|
||||
"print": f"DM room is unavailable. Skipping {name}...",
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user