changed ascend/descend by to work with scopes that have joins values