Opened 3 years ago

Closed 3 years ago

#2151 closed Task (fixed)

UserManager.getUsersSitesFromAccess() doesn't order idsite

Reported by: JulienM Owned by:
Priority: low Milestone: Piwik 1.2.1
Component: Core Keywords:
Cc: Sensitive: no


In my box test_setUserAccess_multipleCallDistinctAccessMultipleUser() fails because

$access1 = array( 'user1' => array(1,2), 'user2' => array(2,3) );
$wanted1 = array( 'user1' => array(1,2), 'user2' => array(3,2) );

This happens because getUsersSitesFromAccess() doesn't order column idsite.

Should we :

  • order idsite
  • sort the array before comparison

Change History (4)

comment:1 Changed 3 years ago by JulienM (JulienMoumne)

  • Summary changed from idsite random order in UserManager.getUsersSitesFromAccess() breaking UserManager.test.php to UserManager.getUsersSitesFromAccess() doesn't order idsite

comment:2 Changed 3 years ago by vipsoft (robocoder)

  • Milestone set to 1.3 - Piwik 1.3

Interesting. Presumably, we can't expect login to be sorted either. I would add an "ORDER BY login,idsite" clause to the SQL.

comment:3 Changed 3 years ago by matt (mattab)

sounds good

comment:4 Changed 3 years ago by JulienM (JulienMoumne)

  • Resolution set to fixed
  • Status changed from new to closed

(In [4039]) fixes #2151 - ordering getUsersSitesFromAccess() SQL query, updating unit tests, should all API queries have an order by clause ?

Note: See TracTickets for help on using tickets.