OK the first bug I reported to myself in the previous post was trivial to fix. I changed the PostReader
class to add a couple of new methods GetFilteredPostsForMonth()
:
public static PostCollection GetFilteredPostsForMonth(int year, int month) { return GetFilteredPostsForDate(year, month, 0); }
and GetFilteredPostsForDate()
:
public static PostCollection GetFilteredPostsForDate(int year, int month, int day) { PostCollection posts = GetPostsForDate(year, month, day); PostCollection filteredPosts = new PostCollection(); foreach (Post post in posts) { if (RolePermissionManager.GetPermissions(post.CategoryId, GraffitiUsers.Current).Read) filteredPosts.Add(post); } return filteredPosts; }
Notice that what gets cached is the complete set of posts for the period (it's done in GetPostsForDate()
), not the filtered set.
And then I changed the Chalk-visible GetPostsForMonth()
and the GetPostsForDay()
methods to call these new internal methods instead.
public PostCollection GetPostsForMonth(string yearAsString, string monthAsString) { int year, month; GetDateParts(yearAsString, monthAsString, out year, out month); return PostsReader.GetFilteredPostsForMonth(year, month); } public PostCollection GetPostsForDay(string yearAsString, string monthAsString, string dayAsString) { int year, month, day; GetDateParts(yearAsString, monthAsString, dayAsString, out year, out month, out day); return PostsReader.GetFilteredPostsForDate(year, month, day); }
Done.
Now, onto paging...
(Part 1 is here, part 2 here, part 3 here, part 4 here, part 4a here, part 4b here.)
Now playing:
Pet Shop Boys - In the Night
(from Further listening 1984-1986)
1 Response
#1 Dew Drop – January 17, 2009 | Alvin Ashcraft's Morning Dew said...
17-Jan-09 7:26 PMPingback from Dew Drop – January 17, 2009 | Alvin Ashcraft's Morning Dew
Leave a response
Note: some MarkDown is allowed, but HTML is not. Expand to show what's available.
_emphasis_
**strong**
[text](url)
`IEnumerable`
* an item
1. an item
> Now is the time...
Preview of response