Bug causes wrong number of items to be shown


Great module, but very difficult to find on the web, why don't you add it to SnowCovered?
There is a logical bug in the code that iterates for each category instead over all items finding the first n of a category but searching only in the first n about entries that fit to the category
A possible alternative code could look like (I changed also the formatting, so adopt please)
        Dim arrEvents As ArrayList = objEventController.EventsGetByRange(_moduleID, Today.ToString(), Today.AddDays(_days).ToString(), "")
        If arrEvents.Count > 0 Then
            Dim i As Integer = 0
            Dim max As Integer = 0
            For i = 0 To arrEvents.Count - 1
                Dim objEvent As DotNetNuke.Modules.Events.EventInfo = CType(arrEvents(i), DotNetNuke.Modules.Events.EventInfo)
                If ((_category <= 0) Or (_category = objEvent.Category)) Then
                    If (max < _events) Then
                        Dim dr As DataRow = dt.NewRow()
                        dr("EventDateBegin") = String.Format(New System.Globalization.CultureInfo("de-DE"), "{0:D}", objEvent.EventDateBegin)
                        dr("EventClassName") = "title"
                        dr("EventName") = objEvent.EventName
                        dr("LocationName") = objEvent.LocationName
                        dr("DetailsUrlClassName") = "learnMore"
                        dr("DetailsUrl") = AddHTTP(Me.PortalSettings.PortalAlias.HTTPAlias + "/tabid/" + _tabID.ToString() + "/ModuleID/" & _moduleID.ToString() & "/ItemID/" + objEvent.EventID.ToString() + "/mctl/EventDetails/Default.aspx")
                        max = max + 1
                    End If
                End If
        End If
Best regards


curlyfro wrote Jun 14, 2008 at 7:22 AM

thanks Jack. added your bug fix.

wrote Feb 13, 2013 at 1:20 AM