Skip to content

Commit

Permalink
Fix returning full year to account for part_of_range key, and streaml…
Browse files Browse the repository at this point in the history
…ine it now that all the info is already part of the same file
  • Loading branch information
Lou Huang committed Sep 9, 2013
1 parent a48c600 commit 1a59ad8
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions routes/api/v0/query.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use strict"

var naics_2007 = require(process.cwd() + '/data/naics-2007'),
naics_2012 = require(process.cwd() + '/data/naics-2012')
Expand Down Expand Up @@ -44,23 +45,25 @@ exports.get = function ( req, res ) {
}
}
else {
// return full year
// Return full year
var naics_full = []
var the_item

// add other information
// Some processing
for (var i = 0; i < naics_year.items.length; i++) {
the_item = getCode(naics_year, naics_year.items[i].code)
the_item = naics_year.items[i]

// Collapse: this only shows descriptions??
// If part_of_range exists, skip it from inclusion
if (the_item.part_of_range) continue

// Collapse: Undocumented feature to include only codes that are not blanks or referrals to other codes.
if (query.collapse == '1') {
if (the_item.description) {
if (the_item.description.substring(0, 28) == 'See industry description for') continue;
}
if (the_item.description == null) continue;
if (the_item.description_code) continue
// Need to verify that if a description is empty then there is not other information for this code
if (the_item.description == null) continue
}

naics_full[naics_full.length] = getCode(naics_year, naics_year.items[i].code)
naics_full.push(the_item)
}

sendResults(naics_full);
Expand Down

0 comments on commit 1a59ad8

Please sign in to comment.