#248 Fetching spam activities with at least 0 minutes runtime (instead of only the ones longer than 1 day) by PLP-GTR · Pull Request #339 · BeWelcome/rox · GitHub
Skip to content

#248 Fetching spam activities with at least 0 minutes runtime (instead of only the ones longer than 1 day)#339

Draft
PLP-GTR wants to merge 3 commits intoBeWelcome:developfrom
time-wasters:#248
Draft

#248 Fetching spam activities with at least 0 minutes runtime (instead of only the ones longer than 1 day)#339
PLP-GTR wants to merge 3 commits intoBeWelcome:developfrom
time-wasters:#248

Conversation

@PLP-GTR
Copy link
Copy Markdown
Contributor

@PLP-GTR PLP-GTR commented Dec 9, 2023

Heads up: I don't know if auto loader for has to be rebuild manually or the new class in src/Doctrine/Functions/TimestampDiff.php is automatically found.


I have changed the filter for the admin/spam activities (production link):

from

DATEDIFF(a.ends, a.starts) > 1

to

TIMESTAMPDIFF(MINUTE, a.starts, a.ends) >= 0

Result:
image

When writing App\Doctrine\Functions\TimestampDiff I tried to stick to the instructions here:
https://www.doctrine-project.org/projects/doctrine-orm/en/2.17/cookbook/dql-user-defined-functions.html

The seemingly simpler approach to use DATEDIFF(a.ends, a.starts) >= 0 would have lead to the issue, that activities with an end time prior to the start time on the same day would show up. Although this shouldn't be possible at storage logic already, the "> 1" filter was preventing those from showing up, so I kept this logic.

image


Fixes #248

@PLP-GTR PLP-GTR changed the title #248 Fetching activities with at least 0 minutes runtime (instead of only the ones longer than 1 day) #248 Fetching spam activities with at least 0 minutes runtime (instead of only the ones longer than 1 day) Dec 9, 2023
@thisismeonmounteverest
Copy link
Copy Markdown
Contributor

@thisismeonmounteverest
Copy link
Copy Markdown
Contributor

@PLP-GTR Regarding the heads up: In the dev environment most of the times newly introduced classes are found automatically. In the few cases that doesn't help you need to call php bin/console cache:clear. (Which is also needed to create the cache on production.)

@PLP-GTR
Copy link
Copy Markdown
Contributor Author

PLP-GTR commented Dec 9, 2023

@PLP-GTR PLP-GTR marked this pull request as draft December 9, 2023 21:33
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.

Improvement to the activity moderation tool

2 participants