Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in 'extract.timestamps' when dealing with an empty data source #270

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

maxloeffler
Copy link
Contributor

@maxloeffler maxloeffler commented Oct 16, 2024

Prerequisites

  • I adhere to the coding conventions (described here) in my code.
  • I have updated the copyright headers of the files I have modified.
  • I have written appropriate commit messages, i.e., I have recorded the goal, the need, the needed changes, and the location of my code modifications for each commit. This includes also, e.g., referencing to relevant issues.
  • I have put signed-off tags in all commits.
  • I have updated the changelog file NEWS.md appropriately.
  • I have checked whether I need to adjust the showcase file showcase.R with respect to my changes.
  • The pull request is opened against the branch dev.

Description

Include a fix by @bockthom for issue #269 and a new unit test for the previously faulty behavior.

Changelog

Fixed:

  • Fix a bug in extract.timestamps that occurs when the first data.source is empty and leads to a return value of type numeric which should be POSIXct.

Copy link
Collaborator

@bockthom bockthom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR @MaLoefUDS. I had a quick look at it, looks good to me. I just spotted a few minor issues, such as enhancing comments with additional information.

And it also seems that you need to rebase onto the current dev branch.

tests/test-data-cut.R Outdated Show resolved Hide resolved
tests/test-data-cut.R Outdated Show resolved Hide resolved

expect_identical(commit.data, commit.data.expected, info = "Cut Raw commit data.")
expect_identical(mail.data, mail.data.expected, info = "Cut mail data.")
expect_identical(issue.data, issue.data.expected, info = "Cut issue data.")
Copy link
Collaborator

@bockthom bockthom Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe highlight that this is empty: "Cut issue data (empty)."

util-data.R Show resolved Hide resolved
Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.95%. Comparing base (34137e8) to head (1d1fe7f).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #270      +/-   ##
==========================================
+ Coverage   80.92%   80.95%   +0.03%     
==========================================
  Files          16       16              
  Lines        5043     5051       +8     
==========================================
+ Hits         4081     4089       +8     
  Misses        962      962              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

bockthom and others added 3 commits October 17, 2024 21:14
Up until now, `get.data.cut.to.same.date(data.sources =
c("issues", "mails", "commits"))` failed if some of the first data
source was empty, but not if the second one was empty. The reason was
that `NA` values introduced by empty data sources at the beginning of
the data frame turned the data frame into a data frame of numeric
objects instead of POSIXct objects. If there were already POSIXct
objects in the data frame, this did not happen. To prevent the
timestamps to be interpreted as numeric values, make sure that the `NA`
values are always POSIXct objects.

This fixes se-sic#269.

Signed-off-by: Thomas Bock <[email protected]>
This test fails without the previous fix by Thomas Bock but does not
fail when the fix is in place.

This works towards fixing se-sic#269.

Signed-off-by: Maximilian Löffler <[email protected]>
@maxloeffler
Copy link
Contributor Author

*The last force push was just because of rebasing

@bockthom
Copy link
Collaborator

*The last force push was just because of rebasing

That's what I have thought anyway 😄

bockthom
bockthom previously approved these changes Oct 17, 2024
Signed-off-by: Maximilian Löffler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants