Skip to content

Commit 1a34151

Browse files
committed
fixed issue sf-wdi-25#2 :part one
1 parent 7d8abe4 commit 1a34151

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/archives_sidebar/app/views/archives_sidebar/_content.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<% sidebar.archives.each do |month| %>
66
<% counter = sidebar.show_count ? "<em>(#{month[:article_count]})</em>" : "" %>
77
<li>
8-
<%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path( month[:year], "%02i" % (month[:month]+1) ) %>
8+
<%= link_to"#{month[:name]} #{counter}".html_safe, articles_by_month_path( month[:year], "%02i" % (month[:month]) ) %>
99
</li>
1010
<% end %>
1111
</ul>

lib/archives_sidebar/lib/archives_sidebar.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ def parse_request(_contents, _params)
3030
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])
3131

3232
@archives = article_counts.map do |entry|
33-
month = (entry.month.to_i%12)+1
33+
month = (entry.month.to_i%12)
3434
year = entry.year.to_i
3535
{
3636
name: I18n.l(Date.new(year, month), format: '%B %Y'),
37-
month: month - 1,
37+
month: month -1,
3838
year: year,
3939
article_count: entry.count
4040
}

0 commit comments

Comments
 (0)