362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
|
# File 'app/models/concerns/effective_cpd_audit.rb', line 362
def summary
audit = model_name.human
auditee = EffectiveCpd.CpdAudit.human_attribute_name(:user)
reviewer = EffectiveCpd.CpdAuditReview.human_attribute_name(:user)
reviewers = EffectiveCpd.CpdAuditReview.human_attribute_name(:user).pluralize
case status_was
when 'opened'
"The #{audit} has been opened. The #{auditee} and #{reviewers} have been notified. Waiting for the #{auditee} to submit."
when 'started'
"The #{auditee} has started their #{audit}. Waiting for the #{auditee} to submit."
when 'conflicted'
"The #{auditee} has declared a conflict of interest. A new #{reviewer} will be assigned."
when 'conflicted_resolved'
"The #{auditee} had declared a conflict of interest. This has been resolved. Waiting for the #{auditee} to submit."
when 'exemption_requested'
"The #{auditee} has requested an exemption. Waiting for request to be granted or denied."
when 'exemption_granted'
"The exemption request has been granted. This #{audit} may now be closed."
when 'exemption_denied'
"The exemption request has been denied. The #{audit} will continue. Waiting for the #{auditee} to submit."
when 'extension_requested'
"The #{auditee} has requested an extension. Waiting for request to be granted or denied."
when 'extension_granted'
"The extension request has been granted. There is a new deadline. Waiting for the #{auditee} to submit."
when 'extension_denied'
"The extension request has been denied. The deadline remains. Waiting for the #{auditee} to submit."
when 'submitted'
summary = "#{auditee} has submitted their #{audit} wizard."
tasks = "The following tasks remain before it can be completed:"
approval = "Waiting on completeness check, review and determination."
items = completed_requirements.map { |item, done| "<li>#{item}: #{done ? 'Complete' : 'Incomplete'}</li>" }.join
completed_requirements.present? ? "<p>#{summary} #{tasks}</p><ul>#{items}</ul>" : "#{summary} #{approval}"
when 'completed'
"All required materials have been provided. Ready to review. This #{audit} will transition to 'reviewed' after all #{reviewers} have submitted."
when 'missing_info'
"Missing the following information: <ul><li>#{missing_info_reason}</li></ul>"
when 'reviewed'
"The #{audit} has been reviewed and is ready for the final determination to be made."
when 'closed'
"This #{audit} has been closed with a final determination #{determination}. All done."
else
raise("unexpected status #{status}")
end.html_safe
end
|