Enabling distinct ordering on MR_fetchAllSortedBy methods #475

Closed
jmontemayor opened this Issue May 11, 2013 · 8 comments

Comments

Projects
None yet
3 participants
@jmontemayor

I would like the ability to specify different ordering on the fetchAllSortedBy & fetchAllGroupBy methods so that I can set the sortDescriptors with different ascending or descending order.

Currently you can only set ascending = YES or ascending=NO but set sortedBy=@"foo,bar,blah".

Ideally I would like to set ascending = @"YES,NO,NO"

@casademora

This comment has been minimized.

Show comment Hide comment
@casademora

casademora May 11, 2013

Owner

In pretty sure you can just add a + or - before each string attribute to
have that custom sort. So you can do something like

@'+name, -date, +zipcode'

And it'll come out as yes, no, yes for your sort order.

Saul Mora
@casademora

On May 11, 2013, at 12:41 PM, Juan Montemayor notifications@github.com
wrote:

I would like the ability to specify different ordering on the
fetchAllSortedBy & fetchAllGroupBy methods so that I can set the
sortDescriptors with different ascending or descending order.

Currently you can only set ascending = YES or ascending=NO but set
sortedBy=@"foo,bar,blah".

Ideally I would like to set ascending = @"YES,NO,NO"


Reply to this email directly or view it on
GitHubhttps://github.com/magicalpanda/MagicalRecord/issues/475
.

Owner

casademora commented May 11, 2013

In pretty sure you can just add a + or - before each string attribute to
have that custom sort. So you can do something like

@'+name, -date, +zipcode'

And it'll come out as yes, no, yes for your sort order.

Saul Mora
@casademora

On May 11, 2013, at 12:41 PM, Juan Montemayor notifications@github.com
wrote:

I would like the ability to specify different ordering on the
fetchAllSortedBy & fetchAllGroupBy methods so that I can set the
sortDescriptors with different ascending or descending order.

Currently you can only set ascending = YES or ascending=NO but set
sortedBy=@"foo,bar,blah".

Ideally I would like to set ascending = @"YES,NO,NO"


Reply to this email directly or view it on
GitHubhttps://github.com/magicalpanda/MagicalRecord/issues/475
.

@jmontemayor

This comment has been minimized.

Show comment Hide comment
@jmontemayor

jmontemayor May 11, 2013

That generated the following error
keypath -priority not found in entity

This is what I tried:

    self.fetchedResultsController = [Person MR_fetchAllGroupedBy:@"priority"
                                                       withPredicate:predicate
                                                            sortedBy:@"-priority,+name"
                                                           ascending:YES];

Without the + or - it works fine, but I get the lowest priority first (from 1 to 10) then sort by name (from A to Z). If I set ascending to NO, I get highest priority first (from 10 to 1), but name sorted descending (from Z to A). What I want is the highest priority first (from 10 to 1) then sort by name (from A to Z).

That generated the following error
keypath -priority not found in entity

This is what I tried:

    self.fetchedResultsController = [Person MR_fetchAllGroupedBy:@"priority"
                                                       withPredicate:predicate
                                                            sortedBy:@"-priority,+name"
                                                           ascending:YES];

Without the + or - it works fine, but I get the lowest priority first (from 1 to 10) then sort by name (from A to Z). If I set ascending to NO, I get highest priority first (from 10 to 1), but name sorted descending (from Z to A). What I want is the highest priority first (from 10 to 1) then sort by name (from A to Z).

@casademora

This comment has been minimized.

Show comment Hide comment
@casademora

casademora May 12, 2013

Owner

I'm not sure where that code went. It was submitted by someone a couple years ago…

Saul Mora
@casademora
saul@casademora.com

On Saturday, May 11, 2013 at 5:15 PM, Juan Montemayor wrote:

That generated the following error
keypath -priority not found in entity
This is what I tried:
self.fetchedResultsController = [Person MR_fetchAllGroupedBy:@"priority" withPredicate:predicate sortedBy:@"-priority,+name" ascending:YES];

Without the + or - it works fine, but I get the lowest priority first (from 1 to 10) then sort by name (from A to Z). If I set ascending to NO, I get highest priority first (from 10 to 1), but name sorted descending (from Z to A). What I want is the highest priority first (from 10 to 1) then sort by name (from A to Z).


Reply to this email directly or view it on GitHub (#475 (comment)).

Owner

casademora commented May 12, 2013

I'm not sure where that code went. It was submitted by someone a couple years ago…

Saul Mora
@casademora
saul@casademora.com

On Saturday, May 11, 2013 at 5:15 PM, Juan Montemayor wrote:

That generated the following error
keypath -priority not found in entity
This is what I tried:
self.fetchedResultsController = [Person MR_fetchAllGroupedBy:@"priority" withPredicate:predicate sortedBy:@"-priority,+name" ascending:YES];

Without the + or - it works fine, but I get the lowest priority first (from 1 to 10) then sort by name (from A to Z). If I set ascending to NO, I get highest priority first (from 10 to 1), but name sorted descending (from Z to A). What I want is the highest priority first (from 10 to 1) then sort by name (from A to Z).


Reply to this email directly or view it on GitHub (#475 (comment)).

@jmontemayor

This comment has been minimized.

Show comment Hide comment
@jmontemayor

jmontemayor May 12, 2013

I implemented a version of what you mentioned. Hopefully I got it right. It seems to work. It could be prettier. See the pull request.

I implemented a version of what you mentioned. Hopefully I got it right. It seems to work. It could be prettier. See the pull request.

@casademora

This comment has been minimized.

Show comment Hide comment
@casademora

casademora May 12, 2013

Owner

Yeah, I saw it. It needs to:

  1. Follow the code standard in the rest of the code base
  2. not be against master, but against develop instead

Thanks,
Saul

Saul Mora
@casademora
saul@casademora.com

On Saturday, May 11, 2013 at 10:42 PM, Juan Montemayor wrote:

I implemented a version of what you mentioned. Hopefully I got it right. It seems to work. I could be prettier. See the pull request.


Reply to this email directly or view it on GitHub (#475 (comment)).

Owner

casademora commented May 12, 2013

Yeah, I saw it. It needs to:

  1. Follow the code standard in the rest of the code base
  2. not be against master, but against develop instead

Thanks,
Saul

Saul Mora
@casademora
saul@casademora.com

On Saturday, May 11, 2013 at 10:42 PM, Juan Montemayor wrote:

I implemented a version of what you mentioned. Hopefully I got it right. It seems to work. I could be prettier. See the pull request.


Reply to this email directly or view it on GitHub (#475 (comment)).

@jmontemayor

This comment has been minimized.

Show comment Hide comment
@jmontemayor

jmontemayor May 12, 2013

Ok made fixes. Do I just close the other PR or is there a way to delete it?

Ok made fixes. Do I just close the other PR or is there a way to delete it?

@casademora

This comment has been minimized.

Show comment Hide comment
@casademora

casademora May 12, 2013

Owner

I think the other one just gets closed.
Thanks!

Saul Mora
@casademora
saul@casademora.com

On Saturday, May 11, 2013 at 11:01 PM, Juan Montemayor wrote:

Ok made fixes. Do I just close the other PR or is there a way to delete it?


Reply to this email directly or view it on GitHub (#475 (comment)).

Owner

casademora commented May 12, 2013

I think the other one just gets closed.
Thanks!

Saul Mora
@casademora
saul@casademora.com

On Saturday, May 11, 2013 at 11:01 PM, Juan Montemayor wrote:

Ok made fixes. Do I just close the other PR or is there a way to delete it?


Reply to this email directly or view it on GitHub (#475 (comment)).

@tonyarnold

This comment has been minimized.

Show comment Hide comment
@tonyarnold

tonyarnold Apr 8, 2014

Contributor

Given the age of this issue, and the volume of issues we have to work through, I've decided to close this alongside a number of other older issues.

If you can still replicate the issue under the latest in-development version of MagicalRecord (3.0 at the time of writing), please feel free to re-open and one of @magicalpanda/team-magicalrecord will take another look. Thanks!

Contributor

tonyarnold commented Apr 8, 2014

Given the age of this issue, and the volume of issues we have to work through, I've decided to close this alongside a number of other older issues.

If you can still replicate the issue under the latest in-development version of MagicalRecord (3.0 at the time of writing), please feel free to re-open and one of @magicalpanda/team-magicalrecord will take another look. Thanks!

@tonyarnold tonyarnold closed this Apr 8, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment