In order to implement the reactions feature, we needed to create a new table in the database. The model for this can be found in the /app/models/ folder in the question_reaction.rb file.
This table is called question_reactions and it has the following structure:
| id [PK] bigint) | reaction (string) | question_id (bigint) | user_enrollment_id (uuid) | created_at (timestamp) | updated_at (timestamp) |
|---|---|---|---|---|---|
| 1 | like | 108 | 944cff9f-4ef3-4582-ac3e-890ad9a59c81 | 2021-06-09 10:11:42.000000 | 2021-06-09 10:11:42.000000 |
Each time a learner interacts with the reactions widget via the UI (see below), a new record is created in this table.
reaction column is a string that can be either like, love, insightful or confused.question_id column is a foreign key that references the id column in the questions table.user_enrollment_id column is a foreign key that references the id column in the user_enrollments table.
In order to separate the comments from the reactions, we needed to create a new table in the database. The model for this can be found in the /app/models/ folder in the question_comment.rb file. This table is called question_comments and it has the following structure:
| id [PK] bigint) | comment (string) | question_id (bigint) | user_enrollment_id (uuid) | created_at (timestamp) | updated_at (timestamp) |
|---|---|---|---|---|---|
| 1 | This is a comment | 108 | 944cff9f-4ef3-4582-ac3e-890ad9a59c81 | 2021-06-09 10:11:42.000000 | 2021-06-09 10:11:42.000000 |
Each time a learner interacts with the comments modal via the UI (see below), a new record is created in this table.
comment column is a string that contains the comment that the learner has submitted.question_id column is a foreign key that references the id column in the questions table.user_enrollment_id column is a foreign key that references the id column in the user_enrollments table.A new rake task was created to copy qualifying comments from the user_feedbacks table to the question_comments table. This rake task can be found in the /lib/tasks/ folder in the migrate_comment_data_to_comment_table.rake file.

The above work for reactions and comments was done in order to replace the existing feedback feature. The feedback feature was originally implemented as a single table in the database called user_feedbacks. We have not deleted the table as it may still be used to generate user engagement reports. However, we have deprecated the feature and we are no longer using it in the platform.