server/sources/rql2sql.py
branchstable
changeset 3754 a9c641f6193b
parent 3752 4c77a1653374
child 3762 e416186fb91c
equal deleted inserted replaced
3753:310621cfed9b 3754:a9c641f6193b
   210 def fix_selection_and_group(rqlst, selectedidx, needwrap, selectsortterms,
   210 def fix_selection_and_group(rqlst, selectedidx, needwrap, selectsortterms,
   211                             sorts, groups, having):
   211                             sorts, groups, having):
   212     if selectsortterms and sorts:
   212     if selectsortterms and sorts:
   213         sort_term_selection(sorts, selectedidx, rqlst, not needwrap and groups)
   213         sort_term_selection(sorts, selectedidx, rqlst, not needwrap and groups)
   214     if sorts and groups:
   214     if sorts and groups:
       
   215         # when a query is grouped, ensure sort terms are grouped as well
   215         for sortterm in sorts:
   216         for sortterm in sorts:
   216             term = sortterm.term
   217             term = sortterm.term
   217             if not isinstance(term, Constant):
   218             if not isinstance(term, Constant):
   218                 for vref in term.iget_nodes(VariableRef):
   219                 for vref in term.iget_nodes(VariableRef):
   219                     if not vref in groups:
   220                     if not vref in groups: