Keep a log of all activities, not just the latest activity for each activity type. #48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Copy all the fields and the data. Don't copy the unique constraint on user + activity type. We'll now log all the users' activities for each supported type, not just one per user and type.
Add a db migration which:
Add a crud function to get the latest activity for a given user and type.
Add
created_at
andupdated_at
fields to test fixtures, so we can be sure our pre-existing activity data exists with timestamps in the past. Otherwise, the pre-existing activities will be created with the same timestamp (the resolution is seconds) as the new ones created, and the db query to get the latest activity may not always return the new activities.