LEFT | RIGHT |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 | 3 |
4 YUI.add('subapp-browser-charmview', function(Y) { | 4 YUI.add('subapp-browser-charmview', function(Y) { |
5 var ns = Y.namespace('juju.browser.views'), | 5 var ns = Y.namespace('juju.browser.views'), |
6 views = Y.namespace('juju.views'), | 6 views = Y.namespace('juju.views'), |
7 widgets = Y.namespace('juju.widgets'); | 7 widgets = Y.namespace('juju.widgets'); |
8 | 8 |
9 | 9 |
10 /** | 10 /** |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 totalAvailable = 0, | 65 totalAvailable = 0, |
66 totalScore = 0; | 66 totalScore = 0; |
67 | 67 |
68 Y.Array.each(questions, function(category) { | 68 Y.Array.each(questions, function(category) { |
69 var sum = 0; | 69 var sum = 0; |
70 | 70 |
71 Y.Array.each(category.questions, function(question, idx) { | 71 Y.Array.each(category.questions, function(question, idx) { |
72 var categoryName = category.name, | 72 var categoryName = category.name, |
73 questionIndex = categoryName + '_' + idx; | 73 questionIndex = categoryName + '_' + idx; |
74 | 74 |
75 if (scores[categoryName] && scores[categoryName][questionIndex]) { | 75 if (scores && scores[categoryName] && |
| 76 scores[categoryName][questionIndex]) { |
76 var score = parseInt(scores[categoryName][questionIndex], 10); | 77 var score = parseInt(scores[categoryName][questionIndex], 10); |
77 sum += score; | 78 sum += score; |
78 category.questions[idx].score = score; | 79 category.questions[idx].score = score; |
79 } else { | 80 } else { |
80 category.questions[idx].score = undefined; | 81 category.questions[idx].score = undefined; |
81 } | 82 } |
82 }); | 83 }); |
83 | 84 |
84 category.score = sum; | 85 category.score = sum; |
85 totalAvailable += category.questions.length; | 86 totalAvailable += category.questions.length; |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 'browser-overlay-indicator', | 341 'browser-overlay-indicator', |
341 'browser-tabview', | 342 'browser-tabview', |
342 'gallery-markdown', | 343 'gallery-markdown', |
343 'juju-templates', | 344 'juju-templates', |
344 'juju-views', | 345 'juju-views', |
345 'juju-view-utils', | 346 'juju-view-utils', |
346 'prettify', | 347 'prettify', |
347 'view' | 348 'view' |
348 ] | 349 ] |
349 }); | 350 }); |
LEFT | RIGHT |