Closed sulbig closed 4 years ago
I had an issue with selections with multiple conditions not working correctly and discovered the bitwise & and | operators were not being concatenated in the selection string correctly. None were being added after the first bitwise operator.
Using the following example:
selection = select( Incident.assignment_group.equals("1234567890") & Incident.opened_at.after("2020-04-01") & Incident.incident_state.equals("7") ).order_asc(Incident.number)
...I would get: assignment_group=1234567890^opened_at>2020-04-01incident_state=7^ORDERBYnumber
assignment_group=1234567890^opened_at>2020-04-01incident_state=7^ORDERBYnumber
I had to change the following in condition.py to make it work correctly for me.
1) Changed the concatenated variables order so that operator_logical comes first:
@property def __str__(self): return ( (self.operator_logical or "") + self.operand_left + self.operator_conditional + self.operand_right )
2) Set the operator_logical variable here before appending it to the list:
def _set_next(self, next_cond, operator): next_cond.operator_logical = operator self.selection.append(next_cond) return self
...and now I get: assignment_group=1234567890^opened_at>2020-04-01^incident_state=7^ORDERBYnumber
assignment_group=1234567890^opened_at>2020-04-01^incident_state=7^ORDERBYnumber
Yep, you're right. I'll include this in the next release.
PR: https://github.com/rbw/snow/pull/38
Thanks!
Fixed in #38
I had an issue with selections with multiple conditions not working correctly and discovered the bitwise & and | operators were not being concatenated in the selection string correctly. None were being added after the first bitwise operator.
Using the following example:
...I would get:
assignment_group=1234567890^opened_at>2020-04-01incident_state=7^ORDERBYnumber
I had to change the following in condition.py to make it work correctly for me.
1) Changed the concatenated variables order so that operator_logical comes first:
2) Set the operator_logical variable here before appending it to the list:
...and now I get:
assignment_group=1234567890^opened_at>2020-04-01^incident_state=7^ORDERBYnumber