logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
Joe Payne2  
#1 Posted : Tuesday, September 13, 2022 7:59:45 AM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
Not major.

The code seems oddly written. First it looks at a record count for 4 months worth of data, but then only actually trims 3 months worth:

Code:

        protected virtual void MaintainAuditLog()
        {
            DateTime utcDayStart = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, 0, 0, 0);
            DateTime fourMonthsAgo = utcDayStart.AddMonths(-4);

            // SEE IF THERE ARE ANY RECORDS OLDER THAN FOUR MONTHS
            int records = CountAuditLog(fourMonthsAgo);
            if (records > 0)
            {
                // ARCHIVE EVERYTHING OLDER THAN THREE MONTHS
                DateTime threeMonthsAgo = utcDayStart.AddMonths(-3);

                // SAVE THE LOG
                SaveAuditLog(threeMonthsAgo);

                // CLEAR THE LOG
                TrimAuditLog(threeMonthsAgo);
            }
        }

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

shaharyar  
#2 Posted : Tuesday, September 20, 2022 5:08:24 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
I have created a code improvement issue to look into the future release.

Thanks for pointing this out!
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.