Skip to content

closes #5, fixes archives ordering in sidebar#26

Open
Brikky wants to merge 2 commits intosf-wdi-gaia:masterfrom
Brikky:month_order
Open

closes #5, fixes archives ordering in sidebar#26
Brikky wants to merge 2 commits intosf-wdi-gaia:masterfrom
Brikky:month_order

Conversation

@Brikky
Copy link

@Brikky Brikky commented Nov 10, 2016

Closes #5
Sorts the @Archives array before it's sent back by using a multi-value comparison, ensuring archives are correctly sorted by year and month starting from January (or the earliest month with posts.)

@Brikky Brikky changed the title fixes archives ordering in sidebar closes #5, fixes archives ordering in sidebar Nov 10, 2016
@nathanallen
Copy link

Will this play nice with #24 ?

@Brikky
Copy link
Author

Brikky commented Nov 10, 2016

Yes, it's just reorganizing the array of Archives in the same method that builds it.
I tried it out and it works.

@nathanallen
Copy link

nathanallen commented Nov 10, 2016

Is the original SQL query not enough? See

article_counts = Content.find_by_sql(["select count(*) as count, #{date_func} from contents where type='Article' and published = ? and published_at < ? group by year,month order by year desc,month desc limit ? ", true, Time.now, count.to_i])

@Brikky
Copy link
Author

Brikky commented Nov 10, 2016

Yes, though the ordering is reversed.

Looks like that bug didn't actually make its way into the code.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants