Skip to content

Commit

Permalink
Fixing a bug I created when refactoring LemmaClassTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyfox committed Jul 29, 2017
1 parent dd2953c commit e605119
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions eanaEltuMigration/dictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,10 +619,13 @@ Dictionary.prototype.exportLemmaClassTypes = function () {

return models.LemmaClassType.bulkCreate(classTypes).then(function(){
"use strict";
return models.LemmaClassType.findAll({where: {LanguageIsoCode: "nav"}}).then(function(lemmaClassTypes){
return models.LemmaClassType.findAll().then(function(lemmaClassTypes){
self.lemmaClassTypes = {};
for(let i = 0; i < lemmaClassTypes.length; i ++){
self.lemmaClassTypes[lemmaClassTypes[i].classType] = lemmaClassTypes[i].get({plain: true});
if(self.lemmaClassTypes[lemmaClassTypes[i].classType] === undefined){
self.lemmaClassTypes[lemmaClassTypes[i].classType] = [];
}
self.lemmaClassTypes[lemmaClassTypes[i].classType].push(lemmaClassTypes[i].get({plain: true}).id);
}
})
});
Expand Down Expand Up @@ -711,8 +714,10 @@ Dictionary.prototype.exportLemmas = function () {
});

for(let j = 0; j < lemma.classTypes.length; j++){
const classType = self.lemmaClassTypes[lemma.classTypes[j].trim()];
classTypeAssociations.push({ LemmaId: lemma.id, LemmaClassTypeId: classType.id });
const classTypes = self.lemmaClassTypes[lemma.classTypes[j].trim()];
for(let i = 0; i < classTypes.length; i++){
classTypeAssociations.push({ LemmaId: lemma.id, LemmaClassTypeId: classTypes[i] });
}
}

for(let i = 0; i < lemma.linkedLemmas.length; i++){
Expand Down

0 comments on commit e605119

Please sign in to comment.