Best practice forum (Archived)

Question about Totara's Appraisal Tables

 
KuznetsovValerii
Re: Question about Totara's Appraisal Tables
KuznetsovValerii 发表于 2016年02月4日 Thursday 14:34
小组 Totara

Hello John,

Suffixes in table names (like "3" in "appraisal_quest_data_3") are their ids in table "appraisal". So query "SELECT name FROM {appraisal} WHERE id=3" will return appraisal name. These tables created  dynamically during appraisal activation.

Suffixes in column names (like "31" in "data_31") are their ids in table "appraisal_quest_field". So query "SELECT name FROM {appraisal_quest_field} WHERE id=31" will return question name.

How answer are stored also depends on question types. 
Simple questions store answer values in "appraisal_quest_data_[id]" table. Dates stored in timestamps.
 "Long text" also use endings "trust" and "format" to indicate if answer is stored in "html", "plain text", or other format.

"Multiple choice (one answer)" stores id of "appraisal_scale_value" table. 

For some questions it's impossible to know how many fields required for answer during activation, so they are stored in different tables (one to many relationship):.
Answers on "Multiple choice (several answers)" question type stored in "appraisal_scale_data" table. Answers on "... review" questions stored in "appraisal_review_data".

To get question ids for a stage, you need to join "appraisal_stage_page" first to get pages id and then "appraisal_quest_field".

Also, Please find attached db schema structure for appraisals.

Hope this helps, 

Regards,

Valerii