fix cache invariant for grouped todos in context and project view

This commit is contained in:
Reinier Balt 2013-06-19 17:47:51 +02:00
parent 1ae6e13f1d
commit f4908f2b7b
3 changed files with 6 additions and 2 deletions

View file

@ -294,5 +294,9 @@ module ApplicationHelper
})
end
def source_view_key
# uses @project.id or @context.id depending on source_view
source_view_is_one_of(:project, :context) ? "#{@source_view}-#{eval("@#{@source_view}.id")}" : @source_view
end
end

View file

@ -2,7 +2,7 @@
@not_done = @not_done_todos.select {|t| t.context_id == context.id }
# invalidate the cache every day because of staleness or
# rendering of "due in x days" that change without touching updated at of the todo
cache [context, @source_view, current_user.date.strftime("%Y%m%d"), @tag_name] do
cache [context, source_view_key, current_user.date.strftime("%Y%m%d"), @tag_name] do
-%>
<%=
render :partial => 'todos/collection',

View file

@ -2,7 +2,7 @@
@not_done = @not_done_todos.select {|t| t.project_id == project.id }
# invalidate the cache every day because of staleness or
# rendering of "due in x days" that change without touching updated at of the todo
cache [project, @source_view, current_user.date.strftime("%Y%m%d"), @tag_name] do
cache [project, source_view_key, current_user.date.strftime("%Y%m%d"), @tag_name] do
-%>
<%=
title = source_view_is(:project) ? t('projects.actions_in_project_title') : show_project_name(project)