Skip to content

Instantly share code, notes, and snippets.

@hanleybrand
Last active March 29, 2016 16:37
Show Gist options
  • Save hanleybrand/0e59f466dcf40ebd3fd9 to your computer and use it in GitHub Desktop.
Save hanleybrand/0e59f466dcf40ebd3fd9 to your computer and use it in GitHub Desktop.
rubric reports (create the stored procedures). I just run these via a powershell script right now, you can see it at https://gist.github.com/hanleybrand/e448e2bc8bdcf7d58c97 note that these are written against an earlier database schema version, but I looked over the change logs and don't see any changes, so fingers crossed ;-)
use [Roadmap]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- get a list of rubrics from a course - select returns (among other things) a number of pk1s
CREATE procedure [dbo].[SP_RUBRIC_LIST_FOR_COURSE_PK1]
@COURSE_PK1 int
as
select r.course_pk1, cm.COURSE_NAME, r.pk1 as rubric_pk1, r.title as rubric_title
from rubric r
inner join COURSE_MAIN cm on r.course_pk1 = cm.PK1
where r.course_pk1 = @COURSE_PK1
GO
-- a rubric can be linked to either an individual attempt [dbo.ATTEMPT] or a group attempt [dbo.group_attempt]
-- so you need to check both -- for the rubric report I did a count, but could have done a top or exists.
-- I probably would have thought about it more if I was worrying about scaling up
-- the powershell runs this for each rubric and then runs eithe the individual attempt or group attempt script (or both)
-- we recently discovered that you can get empty results if students are graded without the grade-by-rubric feature, so one
-- addition that needs to be made is checking if there are grades but not rubric results so that a note can be added somewhere so
-- the student/instructor/everyone knows somethig is amiss
create procedure [dbo].[SP_RUBRIC_REPORT_COUNT_ATTEMPTS]
@RUBRIC_PK1 int as
select count(group_attempt_pk1) as group_attempts,
COUNT(attempt_pk1) as indiv_attempts
from rubric_link rl inner join evaluation_entity ee on rl.eval_entity_pk1 = ee.pk1
where rl.rubric_pk1 = @RUBRIC_PK1
GO
-- note for both attempt queries that
-- "column heading" is to handle an oddity in the way column names were handled
---- (default values for the names don't return as the defaults) and
-- rcol.position + 1 as 'row score' is to handle the discrepancy between how a row score is handled
-- individual attempts
create procedure [dbo].[SP_RUBRIC_REPORT_INDIV_FOR_RUBRIC_PK1]
@RUBRIC_PK1 int
as
select
r.title as 'rubric title',
-- rl.pk1, rl.rubric_pk1,
gm.TITLE as 'assignment title',
u.USER_ID as 'user name', u.LASTNAME as 'last name', u.FIRSTNAME as 'first name',
-- rl.eval_entity_pk1, re.pk1 as re_pk,
"row name" =
CASE
WHEN rr.header = 'grid.row1.label' THEN 'Formatting'
WHEN rr.header = 'grid.row2.label' THEN 'Organization'
WHEN rr.header = 'grid.row3.label' THEN 'Grammar'
ELSE rr.header
END
,
"column heading" =
CASE
WHEN rcol.header = 'grid.column1.label' THEN 'Novice'
WHEN rcol.header = 'grid.column2.label' THEN 'Competent'
WHEN rcol.header = 'grid.column3.label' THEN 'Proficient'
ELSE rcol.header
END
, rcol.position + 1 as 'row score',
round(rce.selected_percent, 4) as 'row percentage',
rce.feedback 'row feedback',
at.score as 'overall score',
at.INSTRUCTOR_COMMENTS as 'overall feedback'
from rubric_link rl
inner join rubric r on rl.rubric_pk1 = r.pk1
inner join evaluation_entity ee on rl.eval_entity_pk1 = ee.pk1
inner join ATTEMPT at on ee.attempt_pk1 = at.PK1
inner join GRADEBOOK_GRADE gg on at.GRADEBOOK_GRADE_PK1 = gg.PK1
inner join GRADEBOOK_MAIN gm on gg.GRADEBOOK_MAIN_PK1 = gm.PK1
inner join COURSE_USERS cu on gg.COURSE_USERS_PK1 = cu.PK1
inner join USERS u on cu.USERS_PK1 = u.PK1
inner join rubric_eval re on rl.pk1 = re.rubric_link_pk1
inner join rubric_cell_eval rce on re.pk1 = rce.rubric_eval_pk1
inner join rubric_cell rc on rce.rubric_cell_pk1 = rc.pk1
inner join rubric_column rcol on rc.rubric_column_pk1 = rcol.pk1
inner join rubric_row rr on rce.rubric_row_pk1 = rr.pk1
where rl.rubric_pk1 = @RUBRIC_PK1 and (ee.attempt_pk1 is not null)
order by [user name], [row name];
GO
-- group attempts
CREATE procedure [dbo].[SP_RUBRIC_REPORT_GROUPS_FOR_RUBRIC_PK1]
@RUBRIC_PK1 int
as
Select
r.title as 'rubric title',
gm.TITLE as 'assignment title',
ga.group_name as 'group title',
--rr.header as 'row name',
"row name" =
CASE
WHEN rr.header = 'grid.row1.label' THEN 'Formatting'
WHEN rr.header = 'grid.row2.label' THEN 'Organization'
WHEN rr.header = 'grid.row3.label' THEN 'Grammar'
ELSE rr.header
END
,
"column heading" =
CASE
WHEN rcol.header = 'grid.column1.label' THEN 'Novice'
WHEN rcol.header = 'grid.column2.label' THEN 'Competent'
WHEN rcol.header = 'grid.column3.label' THEN 'Proficient'
ELSE rcol.header
END
,
rcol.position + 1 as 'row score',
round(rce.selected_percent, 4) as 'row percentage',
rce.feedback as 'row feedback',
ga.instructor_comments as 'overall feedback',
ga.student_comments
from rubric_link rl
inner join rubric r on rl.rubric_pk1 = r.pk1
inner join evaluation_entity ee on rl.eval_entity_pk1 = ee.pk1
inner join group_attempt ga on ee.group_attempt_pk1 = ga.PK1
inner join GRADEBOOK_MAIN gm on ga.gradebook_main_pk1 = gm.PK1
inner join rubric_eval re on rl.pk1 = re.rubric_link_pk1
inner join rubric_cell_eval rce on re.pk1 = rce.rubric_eval_pk1
inner join rubric_cell rc on rce.rubric_cell_pk1 = rc.pk1
inner join rubric_column rcol on rc.rubric_column_pk1 = rcol.pk1
inner join rubric_row rr on rce.rubric_row_pk1 = rr.pk1
where r.pk1 = @RUBRIC_PK1
order by ga.group_name;
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment