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

Remove users longer than 3 months for longer lists #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

omit01
Copy link
Contributor

@omit01 omit01 commented Nov 4, 2022

Togheter with @Synthetica9, I used the Nerd Night to give LISA some extra features. One of those features is removing the people who are inactive from the larger lists sorted by first and last names.

We filtered this arrays to only use users who had a transaction maximal 3 months ago.

Copy link
Owner

@Addono Addono left a comment

Choose a reason for hiding this comment

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

Given that you guys are - AFAIK - the only one using this, I'm fine merging as is.

However, I would prefer to see the newly changed behaviour reflected in the UI as well, such that a user can understand why certain users are and aren't visible.

It would have been even better if that's something you can toggle as a filter in the fronted. But given the tech stack - or lack thereof in the front end - that's definitely not trivial, so that's probably never going to happen.

@@ -39,20 +39,35 @@ public function beforeView()
usort($byFirstName, function($a, $b) {
return strcmp(strtolower($a[User::FIELD_FIRST_NAME]), strtolower($b[User::FIELD_FIRST_NAME]));
});
$byFirstName = array_filter($byFirstName, function($a) {
$timeStamp = strtotime($a['time']);
$cutOffDate = strtotime('-6 months');
Copy link
Owner

Choose a reason for hiding this comment

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

6 months where PR says 3 months 😕

Comment on lines +53 to +58
$byLastName = array_filter($byLastName, function($a) {
$timeStamp = strtotime($a['time']);
$cutOffDate = strtotime('-6 months');

return ($timeStamp > $cutOffDate);
});
Copy link
Owner

Choose a reason for hiding this comment

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

Code quality wise I would have factored out the filter function into a separate named function. Then both filters can use the same logic twice.

DRY for only two instances of the code is often just an edge care. So I'm fine keeping it like this. More of a general remark.

@Addono
Copy link
Owner

Addono commented Nov 8, 2022

In case this gets merged.

@all-contributors
please add @omit01 for maintenance.
please add @Synthetica9 for maintenance.

@allcontributors
Copy link
Contributor

@Addono

I've put up a pull request to add @omit01! 🎉

I've put up a pull request to add @Synthetica9! 🎉

@koen860
Copy link
Contributor

koen860 commented Nov 8, 2022

I've pulled the master branch with the prod application. Now everyone gets a crown  🎉. But I don't think this is the intention of the code as described in the PR. The leaderboard page is missing the crowns :(. So it would be cool is it works on that page as well. That page is central in de gamification of the app.

Also I get an error when loading the transaction page. The rest of the app works fine.

PS: I think you can close #16

@omit01
Copy link
Contributor Author

omit01 commented Nov 8, 2022

@koen860 I will look into fixing the bug. With the previous update, where I added the recents tab, it was also the case that production didn't work as expected, although I used a copy of the production database.

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.

3 participants