1

Misc fixups

This commit is contained in:
Alex Yatskov 2015-03-17 16:54:01 +09:00
parent cfd5ca4670
commit b8237b18b1
2 changed files with 11 additions and 4 deletions

View File

@ -25,7 +25,7 @@
<iframe src="/profile.html" width="100%" height="250" frameborder="0"></iframe>
</div>
<div class="modal-footer">
<button class="btn btn-danger" id="resetStorage">Reset</button>
<button class="btn btn-warning" id="resetStorage">Reset</button>
<button class="btn btn-default" data-dismiss="modal">Accept</button>
</div>
</div>

View File

@ -235,7 +235,7 @@ function computeRecordCompat(records, context, callback) {
function fixupProfile(profile) {
var fixed = {};
_.each(JSON.parse(profile), function(value, key) {
_.each(JSON.parse(profile || '{}'), function(value, key) {
if (parseFloat(value) !== 0) {
fixed[key] = value;
}
@ -255,9 +255,13 @@ function fixupFeatures(features) {
'compatible'
];
if (!features) {
features = {};
}
var fixed = {};
_.each(keys, function(key) {
fixed[key] = _.has(features, key) ? features[key] : 0;
fixed[key] = features[key] || 0;
});
return fixed;
@ -270,7 +274,10 @@ function getCategories(callback) {
}
var categories = _.map(rows, function(row) {
return {id: row.id, description: row.description};
return {
id: row.id,
description: row.description
};
});
callback(categories);