Class: SakaiInfo::PublishedQuiz
Constant Summary
Constants inherited
from Quiz
Quiz::ACTIVE, Quiz::DELETED, Quiz::INACTIVE, Quiz::RETRACTED_FOR_EDITING
Instance Attribute Summary
Attributes inherited from Quiz
#dbrow, #site, #title
Attributes inherited from SakaiObject
#id
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Quiz
#access_control, #access_control_summary_serialization, #authorizations, #authorizations_serialization, #auths_serialization, #default_serialization, #initialize, #item_count, #items, #items_serialization, #metadata, #metadata_serialization, #section_count, #sections, #sections_serialization, #site_summary_serialization, #status, #summary_serialization
Methods included from ModProps
included
Methods inherited from SakaiObject
#dbrow_only_serialization, #dbrow_serialization, #default_serialization, descendants, #object_type_serialization, #serialize, #shell_serialization, #summary_serialization, #to_csv, #to_json, #to_yaml
Class Method Details
.all_serializations ⇒ Object
381
382
383
384
385
386
387
388
|
# File 'lib/sakai-info/quiz.rb', line 381
def self.all_serializations
[
:default,
:sections,
:items,
:attempts,
]
end
|
.clear_cache ⇒ Object
298
299
300
|
# File 'lib/sakai-info/quiz.rb', line 298
def self.clear_cache
@@cache = {}
end
|
.count_by_site_id(site_id) ⇒ Object
.find(id) ⇒ Object
303
304
305
306
307
308
309
310
311
312
313
314
|
# File 'lib/sakai-info/quiz.rb', line 303
def self.find(id)
id = id.to_s
if @@cache[id].nil?
row = DB.connect[:sam_publishedassessment_t].filter(:id => id.to_i).first
if row.nil?
raise ObjectNotFoundException.new(PublishedQuiz, id)
end
@@cache[id] = PublishedQuiz.new(row)
end
@@cache[id]
end
|
.find_by_site_id(site_id) ⇒ Object
.find_ids_by_site_id(site_id) ⇒ Object
335
336
337
|
# File 'lib/sakai-info/quiz.rb', line 335
def self.find_ids_by_site_id(site_id)
PublishedQuiz.query_by_site_id(site_id).select(:id).all.collect { |row| row[:id] }
end
|
.query_by_site_id(site_id) ⇒ Object
316
317
318
319
320
321
322
323
|
# File 'lib/sakai-info/quiz.rb', line 316
def self.query_by_site_id(site_id)
db = DB.connect
db[:sam_publishedassessment_t].
where(:id =>
db[:sam_authzdata_t].select(:qualifierid).
where(:agentid => site_id,
:functionid => "OWN_PUBLISHED_ASSESSMENT"))
end
|
Instance Method Details
#access_control_class ⇒ Object
#attempts_serialization ⇒ Object
375
376
377
378
379
|
# File 'lib/sakai-info/quiz.rb', line 375
def attempts_serialization
{
"attempts" => self.attempts.collect { |a| a.serialize(:quiz_summary) }
}
end
|
#authorization_class ⇒ Object
#item_class ⇒ Object
351
352
353
|
# File 'lib/sakai-info/quiz.rb', line 351
def item_class
PublishedQuizItem
end
|
#quiz_type ⇒ Object
343
344
345
|
# File 'lib/sakai-info/quiz.rb', line 343
def quiz_type
"published"
end
|
#user_attempts(user_id) ⇒ Object