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

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

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

PLP-GTR
Copy link
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
Contributor

@PLP-GTR Why not just remove the datediff? The original idea was to find all activities that have been created by a member that has been banned because of spamming and that lasted longer than a day. Issue #248 says just show all activities of banned members to remove them if necessary. No need to check anything else.

@thisismeonmounteverest
Copy link
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
Contributor Author

PLP-GTR commented Dec 9, 2023

@PLP-GTR Why not just remove the datediff? The original idea was to find all activities that have been created by a member that has been banned because of spamming and that lasted longer than a day. Issue #248 says just show all activities of banned members to remove them if necessary. No need to check anything else.

Three reasons:

  • I did not know the reason of the initial intention to filter only activities with a date (day) difference of at least +1
  • I did not want to include the negative activities since I don't know what the current production database holds (worst case thousands of activities with negative time)
  • I think it's a sexy solution to include the TIMESTAMPDIFF method and let the initial intention live on (plus it was fun to learn about doctrine/DQL)

I can change the handling if you want, no problem. Let me update #248 and draft this pull request.

@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