Check if record is in a record array before adding it
This commit is contained in:
parent
27da51fcc1
commit
07d2d1ff2a
|
@ -99,6 +99,8 @@ unless window.TravisApplication
|
|||
result = @loadOrMerge(type, json[root])
|
||||
if result && result.id
|
||||
record = type.find(result.id)
|
||||
# TODO: find a nicer way to not add record to record arrays twice
|
||||
if !type._findAllRecordArray || !type._findAllRecordArray.contains(record)
|
||||
type.addToRecordArrays(record)
|
||||
|
||||
# we get other types of records only in a few situations and
|
||||
|
@ -108,6 +110,7 @@ unless window.TravisApplication
|
|||
result = @loadOrMerge(Travis.Repo, json.repository || json.repo)
|
||||
if result && result.id
|
||||
record = Travis.Repo.find(result.id)
|
||||
if !Travis.Repo._findAllRecordArray || !Travis.Repo._findAllRecordArray.contains(record)
|
||||
Travis.Repo.addToRecordArrays(record)
|
||||
|
||||
loadOrMerge: (type, hash, options) ->
|
||||
|
|
Loading…
Reference in New Issue
Block a user