)]}'
{"panko/storage/impl_sqlalchemy.py":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"016afd392e9cafa4ad81ff346096893d0e5e3d02","unresolved":false,"context_lines":[{"line_number":282,"context_line":"                              .filter(*conditions))"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":"                first_model \u003d trait_model"},{"line_number":285,"context_line":"                label_num \u003d 1"},{"line_number":286,"context_line":"                for trait_filter in filters:"},{"line_number":287,"context_line":"                    key \u003d trait_filter.pop(\u0027key\u0027)"},{"line_number":288,"context_line":"                    op \u003d trait_filter.pop(\u0027op\u0027, \u0027eq\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"9f436f4f_6df8e27b","line":285,"updated":"2017-08-18 07:53:31.000000000","message":"you could use enumerate() rather than a variable, but that\u0027s fine","commit_id":"a57cc18945ca934c165c66c45e5746b5739da0a1"}],"panko/tests/functional/storage/test_storage_scenarios.py":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"1ca1b0ab24b10164f9c85a678fd20754539687e1","unresolved":false,"context_lines":[{"line_number":341,"context_line":"    def test_get_event_multiple_trait_filter(self):"},{"line_number":342,"context_line":"        trait_filters \u003d [{\u0027key\u0027: \u0027trait_B\u0027, \u0027integer\u0027: 1},"},{"line_number":343,"context_line":"                         {\u0027key\u0027: \u0027trait_C\u0027, \u0027float\u0027: 0.123456},"},{"line_number":344,"context_line":"                         {\u0027key\u0027: \u0027trait_A\u0027, \u0027string\u0027: \u0027my_Foo_text\u0027}]"},{"line_number":345,"context_line":"        event_filter \u003d storage.EventFilter(self.start, self.end,"},{"line_number":346,"context_line":"                                           traits_filter\u003dtrait_filters)"},{"line_number":347,"context_line":"        events \u003d [event for event in self.conn.get_events(event_filter)]"}],"source_content_type":"text/x-python","patch_set":5,"id":"9f436f4f_a6391ba4","line":344,"updated":"2017-08-21 08:50:39.000000000","message":"why did you change that?","commit_id":"99d591df950271594ee049caa3ff22304437a228"},{"author":{"_account_id":26679,"name":"SU, HAO-CHEN","email":"g0010726@gmail.com","username":"astacksu"},"change_message_id":"aed3c78d6eeb2526c7d9f9dca2376429f5337348","unresolved":false,"context_lines":[{"line_number":341,"context_line":"    def test_get_event_multiple_trait_filter(self):"},{"line_number":342,"context_line":"        trait_filters \u003d [{\u0027key\u0027: \u0027trait_B\u0027, \u0027integer\u0027: 1},"},{"line_number":343,"context_line":"                         {\u0027key\u0027: \u0027trait_C\u0027, \u0027float\u0027: 0.123456},"},{"line_number":344,"context_line":"                         {\u0027key\u0027: \u0027trait_A\u0027, \u0027string\u0027: \u0027my_Foo_text\u0027}]"},{"line_number":345,"context_line":"        event_filter \u003d storage.EventFilter(self.start, self.end,"},{"line_number":346,"context_line":"                                           traits_filter\u003dtrait_filters)"},{"line_number":347,"context_line":"        events \u003d [event for event in self.conn.get_events(event_filter)]"}],"source_content_type":"text/x-python","patch_set":5,"id":"7f287b81_f1cf2255","line":344,"in_reply_to":"9f436f4f_a3fe9635","updated":"2017-08-22 08:49:11.000000000","message":"[fix last comment, and some more info]\nI have explained briefly in the \u0027test\u0027 section of my commit message. I\u0027ll try to explain it here in detail:\nIf we have trait filters [A, B], the subquery produced by the original code would be something like:\n  \n  subB \u003d select tB.id from tB where B\n  subA \u003d select tA.id from tA where A\n  \n  select tB.id from tB, subB, subA \n  where B and subB.id \u003d\u003d subA.id\n\n\nAs one can see, filter A has no effect in this query actually. As for 3 or more trait filters, like the above one, only the last filter has effect.\nSince all the events recorded in advance (method \u0027prepare_data\u0027) have different traits except trait_A. Only putting trait_A at last will the problem in the original code be shown.\nevents:\n1: [\u0027my_Foo_text\u0027, 1, 0.123456, \u003ctimeA\u003e]\n2: [\u0027my_Bar_text\u0027, 101, 100.123456, \u003ctimeB\u003e]\n3: [\u0027my_Zoo_text\u0027, 201, 200.123456, \u003ctimeC\u003e]\n4: [\u0027my_Foo_text\u0027, 301, 300.123456, \u003ctimeD\u003e]\n5: [\u0027my_Bar_text\u0027, 401, 400.123456, \u003ctimeE\u003e]\n6: [\u0027my_Zoo_text\u0027, 501, 500.123456, \u003ctimeF\u003e]\nFor filters given in the test, only event 1 should be selected, but if the original code is used, event 4 would be selected as well.\n\nThough at first glance, this seems to be nothing related to the original bug, but actually, when listing events with non-admin users, it use traits filter [project_id\u003d\u003cpid\u003e, user_id\u003d\u003cuid\u003e] to get the result. Let\u0027s see an example:\n\nevents:\n1: [pA, uA, \u003ctimeA\u003e]\n2: [pA, uA, \u003ctimeB\u003e]\n3: [pB, uB, \u003ctimeC\u003e]\n\ntrait filters: [project_id\u003dpA, user_id\u003duA]\n                  trait A       trait B\n\n\nfor subB, we get [1, 2]  (called tM)\nfor subA, we get [1, 2]  (called tN)\n\nselect tP.id from trait_text as tP, subB, subA \nwhere user_id\u003duA and subB.id \u003d\u003d subA.id\n\nwe get:\n tp.id subB.id subA.id\n[ 1,      1,      1 ]\n[ 1,      2,      2 ]\n[ 2,      1,      1 ]\n[ 2,      2,      2 ]\n\nand finally select tp.id, we get [1,1,2,2]\nwhich is why the limit flag has some weird behavior","commit_id":"99d591df950271594ee049caa3ff22304437a228"},{"author":{"_account_id":26679,"name":"SU, HAO-CHEN","email":"g0010726@gmail.com","username":"astacksu"},"change_message_id":"e9827bb00065cdc160c197096db777f0ca7bc697","unresolved":false,"context_lines":[{"line_number":341,"context_line":"    def test_get_event_multiple_trait_filter(self):"},{"line_number":342,"context_line":"        trait_filters \u003d [{\u0027key\u0027: \u0027trait_B\u0027, \u0027integer\u0027: 1},"},{"line_number":343,"context_line":"                         {\u0027key\u0027: \u0027trait_C\u0027, \u0027float\u0027: 0.123456},"},{"line_number":344,"context_line":"                         {\u0027key\u0027: \u0027trait_A\u0027, \u0027string\u0027: \u0027my_Foo_text\u0027}]"},{"line_number":345,"context_line":"        event_filter \u003d storage.EventFilter(self.start, self.end,"},{"line_number":346,"context_line":"                                           traits_filter\u003dtrait_filters)"},{"line_number":347,"context_line":"        events \u003d [event for event in self.conn.get_events(event_filter)]"}],"source_content_type":"text/x-python","patch_set":5,"id":"9f436f4f_a3fe9635","line":344,"in_reply_to":"9f436f4f_a6391ba4","updated":"2017-08-22 00:32:57.000000000","message":"I have explained briefly in the \u0027test\u0027 section of my commit message. I\u0027ll try to explain it here in detail:\nIf we have trait filters [A, B], the subquery produced by the original code would be something like:\n  \n  subB \u003d select tB.id from tB where B\n  subA \u003d select tA.id from tA where A\n  \n  select tB.id from tB, subB, subA \n  where B and subB.id \u003d\u003d subA.id\n\nAs one can see, filter A has no effect in this query actually. As for 3 or more trait filters, like the above one, only the last filter has effect.\n\nSince all the events recorded in advance (methed \u0027prepare_data\u0027) have different traits except trait_A. Only putting trait_A at last will the problem in the original code be shown.\n\nevents:\n1: [\u0027my_Foo_text\u0027, 1, 0.123456, \u003ctimeA\u003e]\n2: [\u0027my_Bar_text\u0027, 101, 100.123456, \u003ctimeA\u003e]\n3: [\u0027my_Zoo_text\u0027, 201, 200.123456, \u003ctimeA\u003e]\n4: [\u0027my_Foo_text\u0027, 301, 300.123456, \u003ctimeA\u003e]\n5: [\u0027my_Bar_text\u0027, 401, 400.123456, \u003ctimeA\u003e]\n6: [\u0027my_Zoo_text\u0027, 501, 500.123456, \u003ctimeA\u003e]\n\nFor filters given in the test, only event 1 should be selected, but if the original code is used, event 4 would be selected as well.","commit_id":"99d591df950271594ee049caa3ff22304437a228"}]}
