Direct correlation view between learning assignments and their completion results.
Tracks complete assignment lifecycle from assignment to completion with timing and performance metrics.
Includes calculated fields for lifecycle status, assessment results, completion timing, and timeliness analysis.
Uses userid+moduleid relationships to ensure accurate assignment-to-result correlation.
CREATE VIEW vwlearningassignmentcorrelation AS (
SELECT lma.id AS assignment_id,
lma.userid AS user_id,
lma.moduleid AS module_id,
lma.state AS assignment_state,
lma.isoverdue AS is_assignment_overdue,
lma.dateassigned AS assignment_date,
lma.datedue AS assignment_due_date,
lma.daterecommendedforcompletion AS recommended_completion_date,
lma.percentagescore AS assignment_percentage_score,
u.name AS user_name,
u.email AS user_email,
u.department AS user_department,
u.title AS user_title,
lm.name AS module_name,
lm.description AS module_description,
lm.type AS module_type,
lar.id AS result_id,
lar.assessmentpercentagescore AS result_assessment_score,
lar.completionpercentage AS result_completion_percentage,
lar.passpercent AS required_pass_percentage,
lar.lengthinminutes AS completion_duration_minutes,
lar.datecreated AS result_created_date,
lar.datemodified AS result_modified_date,
CASE
WHEN (lar.id IS NOT NULL) THEN 'Completed'::text
WHEN (lma.isoverdue = true) THEN 'Overdue'::text
WHEN ((lma.state)::text = 'Assigned'::text) THEN 'In Progress'::text
ELSE 'Unknown'::text
END AS lifecycle_status,
CASE
WHEN ((lar.assessmentpercentagescore IS NOT NULL) AND (lar.passpercent IS NOT NULL)) THEN
CASE
WHEN (lar.assessmentpercentagescore >= lar.passpercent) THEN 'Passed'::text
ELSE 'Failed'::text
END
ELSE 'Not Assessed'::text
END AS assessment_result,
CASE
WHEN ((lar.datecreated IS NOT NULL) AND (lma.dateassigned IS NOT NULL)) THEN EXTRACT(days FROM (lar.datecreated - lma.dateassigned))
ELSE NULL::numeric
END AS days_to_completion,
CASE
WHEN ((lar.datecreated IS NOT NULL) AND (lma.datedue IS NOT NULL)) THEN
CASE
WHEN (lar.datecreated > lma.datedue) THEN 'Completed Late'::text
ELSE 'Completed On Time'::text
END
ELSE NULL::text
END AS completion_timeliness
FROM (((learningmoduleassignments lma
JOIN userdetails u ON (((lma.userid)::text = (u.id)::text)))
JOIN learningmodules lm ON (((lma.moduleid)::text = (lm.id)::text)))
LEFT JOIN learningassignmentresults lar ON ((((lma.userid)::text = (lar.userid)::text) AND ((lma.moduleid)::text = (lar.moduleid)::text))))
WHERE (((u.state)::text <> 'deleted'::text) AND ((lm.state)::text <> 'deleted'::text))
ORDER BY lma.dateassigned DESC, u.name, lm.name
)
Name | Type | Default | Nullable | Children | Parents | Comment |
---|---|---|---|---|---|---|
assignment_id | varchar(50) | true | ||||
user_id | varchar(50) | true | ||||
module_id | varchar(50) | true | ||||
assignment_state | varchar(50) | true | ||||
is_assignment_overdue | boolean | true | ||||
assignment_date | timestamp without time zone | true | ||||
assignment_due_date | timestamp without time zone | true | ||||
recommended_completion_date | timestamp without time zone | true | ||||
assignment_percentage_score | numeric(20,2) | true | ||||
user_name | varchar(200) | true | ||||
user_email | varchar(200) | true | ||||
user_department | varchar(200) | true | ||||
user_title | varchar(200) | true | ||||
module_name | varchar(100) | true | ||||
module_description | varchar(100) | true | ||||
module_type | varchar(50) | true | ||||
result_id | varchar(50) | true | ||||
result_assessment_score | numeric(20,2) | true | ||||
result_completion_percentage | numeric(20,2) | true | ||||
required_pass_percentage | numeric(20,2) | true | ||||
completion_duration_minutes | numeric(20,2) | true | ||||
result_created_date | timestamp without time zone | true | ||||
result_modified_date | timestamp without time zone | true | ||||
lifecycle_status | text | true | ||||
assessment_result | text | true | ||||
days_to_completion | numeric | true | ||||
completion_timeliness | text | true |
Name | Columns | Comment | Type |
---|---|---|---|
lar.datecreated | 0 | ||
public.learningmoduleassignments | 23 | Learning Module Assignments Table - Stores assignment data for learning modules assigned to users. This table tracks the complete lifecycle of learning module assignments from initial assignment through completion. It serves as the primary source for assignment tracking and correlates with learningassignmentresults via userid+moduleid for comprehensive learning analytics. Key Performance Optimizations: - Data retrieved using module-based API iteration (O(modules) vs O(users)) for better performance - User IDs extracted from assignment response data rather than query parameters - Enables efficient user-module assignment and completion analytics Cross-table Relationships: - userid: Links to userdetails.id for user identification and demographics - moduleid: Links to learningmodules.id for module details and metadata - Correlates with learningassignmentresults on userid+moduleid for assignment-to-completion tracking Analytics Capabilities: - Supports user assignment summaries and module completion rate analysis - Enables performance metrics and learning analytics across user-module relationships - Provides foundation for learning dashboard and reporting functionality |
BASE TABLE |
public.userdetails | 13 | BASE TABLE | |
public.learningmodules | 16 | BASE TABLE | |
public.learningassignmentresults | 13 | Learning Assignment Results Table - Stores detailed results and completion data for learning module assignments. This table captures the outcome and performance metrics when users complete learning module assignments. It serves as the results repository that correlates with learningmoduleassignments to provide complete assignment lifecycle tracking from assignment through completion and assessment. Key Performance Optimizations: - Data retrieved using module-based API iteration (O(modules) vs O(users)) for better performance - User IDs extracted from assignment result response data rather than query parameters - Enables efficient user-module assignment and completion analytics Cross-table Relationships: - userid: Links to userdetails.id for user identification and demographics - moduleid: Links to learningmodules.id for module details and metadata - Correlates with learningmoduleassignments on userid+moduleid for assignment-to-completion tracking Analytics Capabilities: - Supports user assignment summaries and module completion rate analysis - Enables performance metrics and learning analytics across user-module relationships - Provides foundation for learning dashboard, reporting, and performance tracking - Tracks assessment scores, completion percentages, and timing metrics |
BASE TABLE |