Skip to content
This repository was archived by the owner on Jan 16, 2018. It is now read-only.

Commit 381900c

Browse files
author
xenolf
committed
add slot type support to query
1 parent 232fa96 commit 381900c

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

Diff for: src/eveStatic.coffee

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ exports.EvEStatic = class EveStatic
3535
callback()
3636

3737
###
38-
Looks up an array of names and returns an object with name : id
38+
Looks up an array of names and returns an object with name : id : slot (if applicable)
3939
###
4040
find: (nameArr, callback) ->
4141
if not callback?
@@ -53,7 +53,7 @@ exports.EvEStatic = class EveStatic
5353
inStr += '?,' for num in [0 ... nameArr.length]
5454
inStr = inStr.slice 0, -1
5555

56-
@db.all "SELECT typeName, typeID FROM invTypes WHERE typeName IN (#{inStr})", nameArr, (err, rows) ->
56+
@db.all "SELECT i.typeName, i.typeID, e.effectID FROM invTypes as i LEFT JOIN dgmTypeEffects e ON i.typeID = e.typeID AND e.effectID IN (11,12,13,2663) WHERE i.typeName IN (#{inStr})", nameArr, (err, rows) ->
5757
if err
5858
callback err, null
5959
return
@@ -75,7 +75,7 @@ exports.EvEStatic = class EveStatic
7575
callback new Error 'Must call init() first!', null
7676
return
7777

78-
@db.get "SELECT typeID FROM invTypes WHERE typeName = '#{name}'", (err, row) ->
78+
@db.get "SELECT i.typeName, i.typeID , e.effectID FROM invTypes as i LEFT JOIN dgmTypeEffects as e ON i.typeID = e.typeID AND e.effectID IN (11,12,13,2663) WHERE typeName = '#{name}'", (err, row) ->
7979
if err
8080
callback err, null
8181
return

Diff for: static/evedump.db

936 KB
Binary file not shown.

Diff for: test/evestatic-tests.coffee

+13-3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ describe 'EvEStatic', ->
6161
should.not.exist error
6262
should.exist result
6363
result.typeID.should.eql 32342
64+
should.not.exist result.effectID
6465
done()
6566

6667
describe 'find', ->
@@ -98,12 +99,21 @@ describe 'EvEStatic', ->
9899
stat.init (error) ->
99100
should.not.exist error
100101

101-
stat.find ['Tyrfing', 'Erebus'], (error, result) ->
102+
stat.find ['Tyrfing', 'Erebus', 'Quad 3500mm Gallium Cannon'], (error, result) ->
102103
should.not.exist error
103104
should.exist result
105+
104106
result.should.be.instanceOf Array
105107
result[0].typeName.should.eql 'Erebus'
106108
result[0].typeID.should.eql 671
107-
result[1].typeName.should.eql 'Tyrfing'
108-
result[1].typeID.should.eql 32342
109+
should.not.exist result[0].effectID
110+
111+
result[1].typeName.should.eql 'Quad 3500mm Gallium Cannon'
112+
result[1].typeID.should.eql 3571
113+
result[1].effectID.should.eql 12
114+
115+
result[2].typeName.should.eql 'Tyrfing'
116+
result[2].typeID.should.eql 32342
117+
should.not.exist result[2].effectID
118+
109119
done()

0 commit comments

Comments
 (0)