Skip to content

Instantly share code, notes, and snippets.

@mikebuchanon
Created June 26, 2013 14:47
Show Gist options
  • Select an option

  • Save mikebuchanon/5867967 to your computer and use it in GitHub Desktop.

Select an option

Save mikebuchanon/5867967 to your computer and use it in GitHub Desktop.
Queries to find and to update all assessments that need to have their warning time updated from 2 minutes to 10 minutes
--find all assessments in courseids that are visible by students and need to have their TimeWarning time updated
select lo2.title [folder_name],lo.TITLE [assessment_name], le.course_id, qcs.TimeLimit, qcs.TimeWarning
from QuestionContainerSettings qcs
join qti_question_containers qqc (nolock) on qqc.settings_id=qcs.ID
join LSN_ENTRIES le (nolock) on qqc.entry_ID=le.ENTRY_ID
join LSN_OBJECTS lo (nolock) on lo.OBJECT_ID=le.OBJECT_ID
join LSN_ENTRIES le2 (nolock) on le2.ENTRY_ID=le.PARENT_ID
join LSN_OBJECTS lo2 (nolock) on lo2.OBJECT_ID=le2.OBJECT_ID
where le.COURSE_ID like 'course_ids%'
and lo.OBJECT_TYPE='assessment'
and le2.VIEWABLE_BY=2 and le2.HIDDEN=0
and qcs.TimeLimit = 60 and qcs.TimeWarning=2
order by le.course_id, le2.SEQUENCE
--update all assessments in courseids that are visible by students and need to have their TimeWarning time updated
update qcs
set qcs.timewarning=10
from QuestionContainerSettings qcs
join qti_question_containers qqc (nolock) on qqc.settings_id=qcs.ID
join LSN_ENTRIES le (nolock) on qqc.entry_ID=le.ENTRY_ID
join LSN_OBJECTS lo (nolock) on lo.OBJECT_ID=le.OBJECT_ID
join LSN_ENTRIES le2 (nolock) on le2.ENTRY_ID=le.PARENT_ID
join LSN_OBJECTS lo2 (nolock) on lo2.OBJECT_ID=le2.OBJECT_ID
where le.COURSE_ID like 'course_ids%'
and lo.OBJECT_TYPE='assessment'
and le2.VIEWABLE_BY=2 and le2.HIDDEN=0
and qcs.TimeLimit = 60 and qcs.TimeWarning=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment