Skip to content

Commit

Permalink
Merge pull request #481 from geeksforsocialchange/show-future-events
Browse files Browse the repository at this point in the history
fix: Show future events
  • Loading branch information
james-collapse authored Dec 17, 2024
2 parents d11d0ab + fbeb18d commit 2fe1679
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/Data/PlaceCal/Events.elm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Data.PlaceCal.Events exposing (Event, EventPartner, afterDate, eventFromSlug, eventPartnerFromId, eventsData, eventsFromDate, eventsFromRegionId, eventsWithPartners, nextNEvents, onOrBeforeDate)
module Data.PlaceCal.Events exposing (Event, EventPartner, afterDate, eventFromSlug, eventPartnerFromId, eventsData, eventsOnDate, eventsFromRegionId, eventsWithPartners, nextNEvents, onOrBeforeDate)

import BackendTask
import BackendTask.Custom
Expand Down Expand Up @@ -99,11 +99,11 @@ eventsFromRegionId eventList regionId =
List.filter (\event -> event.partnershipTagId == regionId) eventList


eventsFromDate : List Event -> Time.Posix -> List Event
eventsFromDate eventList fromDate =
eventsOnDate : List Event -> Time.Posix -> List Event
eventsOnDate eventList onDate =
List.filter
(\event ->
TransDate.isSameDay event.startDatetime fromDate
TransDate.isSameDay event.startDatetime onDate
)
eventList

Expand Down
6 changes: 3 additions & 3 deletions src/Theme/Page/Partner.elm
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ viewPartnerEvents events localModel partner =
in
section [ id "events" ]
(if List.length futureEvents > 0 then
-- If we have more than 20 future events paginate
if List.length futureEvents > 20 then
-- If we have more than 40 future events paginate
if List.length futureEvents > 40 then
[ eventAreaTitle
, Theme.Paginator.viewPagination localModel |> Html.Styled.map Theme.Page.Events.fromPaginatorMsg
, Theme.Page.Events.viewEventsList localModel events Nothing
Expand All @@ -91,7 +91,7 @@ viewPartnerEvents events localModel partner =
else
-- Otherwise show them all
[ div []
[ Theme.Page.Events.viewEventsList localModel futureEvents Nothing
[ Theme.Page.Events.viewEventsList { localModel | filterByDate = Theme.Paginator.Future } events Nothing
]
]

Expand Down
2 changes: 1 addition & 1 deletion src/Theme/Paginator.elm
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ filterEvents : Time.Posix -> Filter -> List Data.PlaceCal.Events.Event -> List D
filterEvents now filter eventList =
case filter of
Day time ->
Data.PlaceCal.Events.eventsFromDate eventList time
Data.PlaceCal.Events.eventsOnDate eventList time

Past ->
List.reverse (Data.PlaceCal.Events.onOrBeforeDate eventList now)
Expand Down

0 comments on commit 2fe1679

Please sign in to comment.