why bother going through the artifact layers to get the target data - it's already in the portal details!!

This commit is contained in:
Jon Atkins 2015-07-10 08:14:56 +01:00
parent 996ef2a881
commit 12f84721fa
2 changed files with 4 additions and 20 deletions

View File

@ -156,21 +156,6 @@ window.artifact.getPortalData = function(guid,artifactId) {
return artifact.portalInfo[guid] && artifact.portalInfo[guid][artifactId]; return artifact.portalInfo[guid] && artifact.portalInfo[guid][artifactId];
} }
// get the target(s) at a specified portal. returns 'false'y if the portal isn't a target
window.artifact.getPortalTarget = function(guid) {
targets = {};
if (artifact.portalInfo[guid]) {
for (var type in artifact.artifactTypes) {
if (artifact.portalInfo[guid][type].target !== undefined) {
targets[type] = artifact.portalInfo[guid][type].target;
}
}
}
return Object.keys(targets).length == 0 ? null : targets;
}
window.artifact.updateLayer = function() { window.artifact.updateLayer = function() {
artifact._layer.clearLayers(); artifact._layer.clearLayers();
@ -237,7 +222,7 @@ window.artifact.showArtifactList = function() {
$.each(artifact.artifactTypes, function(type,type2) { $.each(artifact.artifactTypes, function(type,type2) {
// no nice way to convert the Niantic internal name into the correct display name // no nice way to convert the Niantic internal name into the correct display name
// (we do get the description string once a portal with that shard type is selected - could cache that somewhere?) // (we do get the description string once a portal with that shard type is selected - could cache that somewhere?)
var name = type.substr(0,1).toUpperCase() + type.substr(1) + ' shards'; var name = type.capitalize() + ' shards';
if (!first) html += '<hr>'; if (!first) html += '<hr>';
first = false; first = false;

View File

@ -190,11 +190,10 @@ window.getPortalMiscDetails = function(guid,d) {
// artifacts - tacked on after (but not as part of) the 'randdetails' table // artifacts - tacked on after (but not as part of) the 'randdetails' table
// instead of using the existing columns.... // instead of using the existing columns....
// fill in target status from the artifact code if (d.artifactBrief && d.artifactBrief.target && Object.keys(d.artifactBrief.target).length > 0) {
var targets = artifact.getPortalTarget(guid); var targets = Object.keys(d.artifactBrief.target);
if (targets) {
//currently (2015-07-10) we no longer know the team each target portal is for - so we'll just show the artifact type(s) //currently (2015-07-10) we no longer know the team each target portal is for - so we'll just show the artifact type(s)
randDetails += '<div id="artifact_target">Target portal: '+Object.keys(targets).map(function(x) { return x.substr(0,1).toUpperCase()+x.substr(1); }).join(', ')+'</div>'; randDetails += '<div id="artifact_target">Target portal: '+targets.map(function(x) { return x.capitalize(); }).join(', ')+'</div>';
} }
// shards - taken directly from the portal details // shards - taken directly from the portal details