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

Show creation date of comments #448

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

chrgernoe
Copy link
Member

Fixes #447

@chrgernoe chrgernoe requested a review from paetz January 14, 2024 23:39
@github-actions github-actions bot added the feature New feature or request label Jan 14, 2024
@chrgernoe chrgernoe force-pushed the feature/447_show-creation-date-of-comments branch from 43d4292 to 0855997 Compare January 14, 2024 23:49
paetz
paetz previously approved these changes Jan 17, 2024
@@ -136,10 +137,11 @@ class SectorParser(private val _db: DatabaseWrapper) : JSONWebParser() {
for (i in 0 until jsonComments.length()) {
val jsonComment = jsonComments.getJSONObject(i)
val user = jsonComment.getString("username")
val date = _parseCommentDate(jsonComment.getString("datum"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is also an "adatum" field which may contain the date of the latest change. Would this make more sense?

Copy link
Member Author

Choose a reason for hiding this comment

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

I had a look into the PHP code of sandsteinklettern.de and for my understanding it is the archive date. It is updated, when the comment gets updated.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm now prioritizing the adatum and use datum as fallback.

* Parse comment date-times in the format yyyy-MM-dd HH:mm:ss
* and return only the date in the format yyyy-MM-dd.
*/
private fun _parseCommentDate(date: String): String = DateUtils.formatDate(date.split(" ")[0])
Copy link
Collaborator

@paetz paetz Jan 17, 2024

Choose a reason for hiding this comment

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

  • You should add error handling here in case date is an empty string.

@chrgernoe chrgernoe force-pushed the feature/447_show-creation-date-of-comments branch from 0855997 to bb35a84 Compare January 24, 2024 21:05
@chrgernoe chrgernoe requested a review from paetz January 24, 2024 21:05
@chrgernoe chrgernoe merged commit c9eec4b into master Jan 30, 2024
5 checks passed
@chrgernoe chrgernoe deleted the feature/447_show-creation-date-of-comments branch January 30, 2024 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show creation date of comments
2 participants