Implement the logic to collect and persist edit metrics after the revision is saved, associating the data with the correct ongoing event and user.
This logic must run only when:
- The user is participating in an ongoing event
- The user selected an event in the event selection field
The following metrics must be computed and saved in ce_event_edit_association:
- Event ID
- Revision ID
- User ID
- Bytes added
- Bytes removed
- Characters added
- Characters removed
- Timestamp of the edit
This task does not include creating the DB access layer class — that is covered by another task.
BDD
gherkin
Feature: Save edit-event association and metrics after revision is saved
Scenario: User selects an event and saves an edit during an ongoing event
Given the user is logged in
And the user is participating in an ongoing event
And the user selected an event before saving
When the user saves the revision
Then the following metrics are calculated and saved:
| event_id |
| revision_id |
| user_id |
| bytes_added |
| bytes_removed |
| characters_added |
| characters_removed |
| edit_timestamp |
Scenario: User does not select any event
Given the user is participating in an ongoing event
And the event field is left empty
When the user saves the revision
Then nothing is stored in ce_event_edit_association