Select bug fixes

This commit is contained in:
Colin McLeod
2015-05-04 21:03:23 -07:00
parent 326bb13e41
commit c24ac043ac
3 changed files with 4 additions and 5 deletions

View File

@@ -4,13 +4,13 @@ angular.module('app').directive('componentSelect', function() {
function appendGroup(list, opts, cid, mass) {
var prevClass = null, prevRating = null;
var count = Object.keys(opts).length;
for (var i = 0; i < opts.length; i++) {
var o = opts[i];
var id = o.id || (o.class + o.rating); // Common components' ID is their class and rating
list.push('<li class="', o.name? 'lc' : 'c');
if(o.class != prevClass && count > 6) list.push(' cl');
if(o.class != prevClass && o.rating != prevRating) list.push(' cl');
if (cid == o.id) list.push(' active');
list.push((o.maxmass && mass > o.maxmass)? ' disabled"' : '" cpid="', o.id, '">', o.class, o.rating);
list.push((o.maxmass && mass > o.maxmass)? ' disabled"' : '" cpid="', id, '">', o.class, o.rating);
if(o.mode) {
list.push('/' + o.mode);
if(o.missile) {

View File

@@ -15,7 +15,6 @@ angular.module('app').service('Serializer', ['lodash', function (_) {
_.map(ship.hardpoints, idToStr),
_.map(ship.internal, idToStr),
];
console.log('code',_.flatten(data).join(''));
return _.flatten(data).join('');
};

View File

@@ -58,7 +58,7 @@ angular.module('shipyard').factory('ComponentSet', ['lodash', function (_) {
};
function filter (data, maxClass, minClass, mass) {
return _.filter(data, function (c) {
return _.filter(data, function (c, index, collection) {
return c.class <= maxClass && c.class >= minClass && (c.maxmass === undefined || mass <= c.maxmass)
});
}