-
Notifications
You must be signed in to change notification settings - Fork 21
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
Feat/user event log #365
Feat/user event log #365
Conversation
…y, update entities, migration, and helper util to reflect
… logEvent unit test
…vent logs page to nav
…nt, as actions can be performed by both users and useraccounts (see #361)
…er actions from quantifier actions (as there will be a lot of both)
…ange the endDate of the last period (see #375)
…se and replace-quantifier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…nt, update page & component styling to mirror other page styles
…for grammatic uniformity
…within AuthenticatedLayout
…se on every call of quantify. Improve event log message
…quantification action
done
done With this UX change, I had to add some additional conditionals to determine which user name to store. There will very likely be weird / inconsistent bugs with the displayed user name (until we implement #361 and refactor out the confusion around users and useraccounts). Currently, some actions are taken by useraccounts (sometimes without an associated user), while others are taken by users. Thus the eventlog model has to store both the user id and / or the useraccount id. Thus we need to conditionally determine the user name to display based on the data available within each individual event log. Also I just wanted to make sure you saw this from the comment above. Let me know if you think it requires any changes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
The only thing I noticed is that the "← Previous" page link don't appear.
Currently, some actions are taken by useraccounts (sometimes without an associated user), while others are taken by users. Thus the eventlog model has to store both the user id and / or the useraccount id. Thus we need to conditionally determine the user name to display based on the data available within each individual event log.
Yes. We need to clear this up and decide on a model that is more sustainable. Let's continue discussion in #361.
Also, just a note that currently makes individual quantification scores public, before the quantification period is closed. Perhaps it should be modified to only include quantification user events after the related period is closed.
Sounds like a good idea. If I remember correctly the rule is this:
- Admins can see everything
- Users and Quantifiers can only see scores after period has been closed
… related to a period that is active (for hiding quantification events while the quantification period is active)
…nameRealized' in UserDto. Explicitly pass current user roles into transformers for clarity
… % finished quantifications, then by quantifier _id
Fixed
Done. Quantification event logs for an active period are still included, but their description is obscured by a Notice that says "Praise scores are not visible during quantification" (the same notice as in the PeriodDetailPage). I think it makes sense to include them with a notice hiding the details rather than to exclude them entirely. But let me know what you think: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
)}`; | ||
}; | ||
|
||
export const generateUserName = async (user: UserDocument): Promise<string> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, like we talked about, attempting to establish a single source of truth for every business rule. And to push it as far up the "tree" as possible with the database representing the "root node".
…ed (reflect changes in #365), switch to using shortenEthAddress implementation from api.
Resolves #309
Resolves #375
Overview
/api/eventlogs/all
logEvent()
logEvent()
calls everywhere that a user event occurs (see list above)nameRealized
To limit the scope for this PR, I did not include custom filtering / searching / sorting of event logs. (I created another ticket #376). I also did not include infinite-scroll. Let me know if you think its preferable to just build out that functionality as part of this PR.
--
Our outline of this feature in #309 was kinda fuzzy, so I tried to think it through and decide on what to include in this UserEventLog data. This is all open to feedback and revision!
Here's what I came up with:
So the only data included in this log are the following user actions which change the database state:
This does not account for changes made by a sysadmin directly to the database itself (i.e. bypassing the application interfaces).
Also, just a note that currently makes individual quantification scores public, before the quantification period is closed. Perhaps it should be modified to only include quantification user events after the related period is closed.