Skip to content

write.config.PEPRMT: skip event sorting when no supported events remain - #4267

Draft
madhavzanwar wants to merge 4 commits into
PecanProject:developfrom
madhavzanwar:GH-4255-peprmt-no-supported-events
Draft

madhavzanwar wants to merge 4 commits into
PecanProject:developfrom
madhavzanwar:GH-4255-peprmt-no-supported-events

Conversation

@madhavzanwar

Copy link
Copy Markdown
Contributor

Fixes #4255

What

After filtering to the supported event types, write.config.PEPRMT() sorted evts with as.Date(sapply(evts, ...)), which errors on an empty list. This happens when the events file has no supported events for the site (for example, planting-only events). The sort now runs only when length(evts) > 0, so a run with no supported events behaves the same as a run with no events at all.

A CHANGELOG entry is added (PEPRMT has no NEWS.md).

Testing

The new test in test-write.config.PEPRMT.R (an events file with only planting events) fails on develop and passes with the fix. The rest of the PEPRMT test file passes.

 skip event sorting when no supported events remain

Fixes #Sorting an empty list of events with as.Date(sapply(...)) errors. Only sort when there are events.:4255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

write.config.PEPRMT() errors when the event file has no supported events for the site

1 participant