Created
June 5, 2013 16:05
-
-
Save theSociableme/5715089 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Assessments.Views.Teacher.Results.Gradebook extends Backbone.View | |
sdk_url: 'https://downloads.gradecam.com/sdk/current/gcsdk.js' | |
sdk_css_url: 'https://downloads.gradecam.com/sdk/current/css/gcsdk.css' | |
gradebook_settings: null | |
el: '#gradecam' | |
initialize: (options) -> | |
w = window | |
window.gradeCamOnPluginLoad = () => | |
w.gradecam.stopCamera() | |
@loaded() | |
window.gradeCamOnAPILoad = () => | |
g = window.gradecam | |
@$el[0].appendChild(g.getElement()) | |
@options = options | |
@$el.show() | |
script = document.createElement('script') | |
script.type = 'text/javascript' | |
script.src = @sdk_url | |
document.body.appendChild(script) | |
css = document.createElement('link') | |
css.type = 'text/css' | |
css.rel = 'stylesheet' | |
css.href = @sdk_css_url | |
document.body.appendChild(css) | |
loaded: () => | |
g = window.gradecam | |
hotkey = @options.gradebook_settings.hot_key | |
return_key = @options.gradebook_settings.return_key | |
speed = parseInt(@options.gradebook_settings.speed) | |
g.initTyper(hotkey, speed, return_key) | |
g.setHotKeyCallback => | |
g.typeScores(@getResults()) | |
$('#running').hide(); | |
getResults: () -> | |
_.map(@sortResults(), (r) -> | |
r.score) | |
sortResults: () -> | |
if @options.gradebook_settings.name_sorting == 'fnln' | |
return @options.results.sort(@cmpResultFirstLast) | |
else if @options.gradebook_settings.name_sorting == 'rlnfn' | |
return @options.results.sort(@cmpResultReverseLastFirst) | |
else if @options.gradebook_settings.name_sorting == 'rfnln' | |
return @options.results.sort(@cmpResultReverseFirstLast) | |
else | |
return @options.results.sort(@cmpResultLastFirst) | |
cmpResultLastFirst: (a, b) -> | |
if a.student_last_name != b.student_last_name | |
if a.student_last_name < b.student_last_name | |
return -1 | |
else | |
return 1 | |
else | |
if a.student_first_name != b.student_first_name | |
if a.student_first_name < b.student_first_name | |
return -1 | |
else | |
return 1 | |
else | |
return 0 | |
cmpResultReverseLastFirst: (a, b) -> | |
if a.student_last_name != b.student_last_name | |
if a.student_last_name > b.student_last_name | |
return -1 | |
else | |
return 1 | |
else | |
if a.student_first_name != b.student_first_name | |
if a.student_first_name > b.student_first_name | |
return -1 | |
else | |
return 1 | |
else | |
return 0 | |
cmpResultFirstLast: (a, b) -> | |
if a.student_first_name != b.student_first_name | |
if a.student_first_name < b.student_first_name | |
return -1 | |
else | |
return 1 | |
else | |
if a.student_last_name != b.student_last_name | |
if a.student_last_name < b.student_last_name | |
return -1 | |
else | |
return 1 | |
else | |
return 0 | |
cmpResultReverseFirstLast: (a, b) -> | |
if a.student_first_name != b.student_first_name | |
if a.student_first_name > b.student_first_name | |
return -1 | |
else | |
return 1 | |
else | |
if a.student_last_name != b.student_last_name | |
if a.student_last_name > b.student_last_name | |
return -1 | |
else | |
return 1 | |
else | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not certain where you found the information for this -- I assume you were working on something for a gradecam partner -- but I would be a lot happier if you could move it into a private gist or just take it down entirely. I have no issue with our partners having this (it looks well written), but all GradeCam partners signed an NDA indicating that nothing containing information such as is demonstrated here would be released like this.
Our main concern and reason for wanting to not have this kind of info posted publicly is that someone might find it and not realize that the technology needs to be licensed before it's legal for someone to use. If someone did start using it that way we have ways of discovering that, but then we're stuck telling someone they have to shut things down and could even end up in a case where we'd have to pursue some form of litigation to make them stop, etc... at that point, everyone loses =] If you have any questions I can be reached at rbateman@gradecam.com