This project is read-only.

Archives Count Issue

Topics: Administration, Customizing Orchard, General, Troubleshooting
Apr 22, 2013 at 6:38 AM
When delete blog post the count is not decreased.
The _previouscreatedUtc values is initialized in BlogPartArchiveHandler class.
But it is having the values as count 0 after constructor calling. Due to this archives count is calulated incorrectly.
Can you please help me to fix this issue?
public class BlogPartArchiveHandler : ContentHandler {
    private readonly IWorkContextAccessor _workContextAccessor;
    // contains the creation time of a blog part before it has been changed
    private readonly Dictionary<BlogPostPart, DateTime> _previousCreatedUtc = new Dictionary<BlogPostPart,DateTime>();

    public BlogPartArchiveHandler(
        IRepository<BlogPartArchiveRecord> blogArchiveRepository, 
        IBlogPostService blogPostService,
        IWorkContextAccessor workContextAccessor) {
        _workContextAccessor = workContextAccessor;

        OnVersioning<BlogPostPart>((context, bp1, bp2) => {
           __ var commonPart = bp1.As<CommonPart>();
            if(commonPart == null || !commonPart.CreatedUtc.HasValue || !bp1.IsPublished)

            _previousCreatedUtc[bp2] = commonPart.CreatedUtc.Value;__

        OnPublished<BlogPostPart>((context, bp) => RecalculateBlogArchive(blogArchiveRepository, bp));
        OnUnpublished<BlogPostPart>((context, bp) => RecalculateBlogArchive(blogArchiveRepository, bp));
        OnRemoved<BlogPostPart>((context, bp) => RecalculateBlogArchive(blogArchiveRepository, bp));
Apr 22, 2013 at 6:40 AM
Apr 22, 2013 at 6:59 AM
Hi BertrandLeRoy,
I am not able to find any replies on the above link. I can find the issue description alone. Can you please let me know the solution for this issue?
Apr 22, 2013 at 7:05 AM
No, I can't. It's a bug, and until it's fixed, I'm afraid I don't have a solution for you, sorry.