From 7c6fedad25cc31ffa9fab8d71f4a946daba454cb Mon Sep 17 00:00:00 2001 From: Zoe Snow Date: Mon, 17 Jul 2017 14:29:23 -0600 Subject: [PATCH] Updating some things to support a newer version of MySQL --- app.js | 2 +- eanaEltuMigration/dictionary.js | 45 ++++++++++++++++++++------------ models/dictionaryTemplate.js | 4 +-- models/localizedMetadata.js | 2 +- models/localizedentry.js | 2 +- vault.js | Bin 926 -> 941 bytes 6 files changed, 33 insertions(+), 22 deletions(-) diff --git a/app.js b/app.js index 9b7760d..5758b2f 100644 --- a/app.js +++ b/app.js @@ -1,5 +1,5 @@ -process.env.NODE_ENV = "mamp"; +process.env.NODE_ENV = "development"; var express = require('express'); var path = require('path'); diff --git a/eanaEltuMigration/dictionary.js b/eanaEltuMigration/dictionary.js index 165bce3..004e8c1 100644 --- a/eanaEltuMigration/dictionary.js +++ b/eanaEltuMigration/dictionary.js @@ -153,7 +153,7 @@ Dictionary.prototype.exportLanguages = function (){ } return models.Language.bulkCreate(languages).then(function() { - models.Language.findAll().then(function (languages) { + return models.Language.findAll().then(function (languages) { languages.forEach(function (language) { self.languages[language.isoCode] = language; }); @@ -174,7 +174,7 @@ Dictionary.prototype.exportSources = function(){ } return models.Source.bulkCreate(sources).then(function() { - models.Source.findAll().then(function (sources) { + return models.Source.findAll().then(function (sources) { sources.forEach(function (source) { self.sources[source.name] = source; }); @@ -188,22 +188,28 @@ Dictionary.prototype.exportDictionaryTemplates = function () { var templates = [ { id: "localized_end", - latex: "__END__" + latex: "__END__", + html: "" }, { id: "newpage", - latex: "\\newpage" + latex: "\\newpage", + html: "" }, { id: "end_hangparas_multicols", - latex: "\\end{hangparas}}\\end{multicols}" + latex: "\\end{hangparas}}\\end{multicols}", + html: "" }, { id: "end_hangparas", - latex: "\\end{hangparas}" + latex: "\\end{hangparas}", + html: "" }, { id: "end_document", - latex: "\\end{document}" + latex: "\\end{document}", + html: "" }, { id: "end_hangparas_multicols_newpage", - latex: "\\end{hangparas}}\\end{multicols}+\\newpage" + latex: "\\end{hangparas}}\\end{multicols}+\\newpage", + html: "" }]; for(var id in self.eanaEltu.dictLayout){ @@ -216,7 +222,8 @@ Dictionary.prototype.exportDictionaryTemplates = function () { } templates.push({ id: layout.id.toLowerCase(), - latex: layout.value + latex: layout.value, + html: "" }); } @@ -457,6 +464,9 @@ Dictionary.prototype.exportEntryLayouts = function () { metadata: template.metadata }); } else { + if(template.format === undefined || template.format === null){ + template.format = "<< BLANK >>"; + } localizedLayouts.push({ EntryTypeId: templateId, LanguageIsoCode: lang, @@ -602,7 +612,7 @@ Dictionary.prototype.export = function (callback) { var secondLayerPromises = []; secondLayerPromises.push(self.exportDictionaryBuilds()); secondLayerPromises.push(self.exportMetadata()); - secondLayerPromises.push(self.exportPartsOfSpeech()); + //secondLayerPromises.push(self.exportPartsOfSpeech()); Promise.all(secondLayerPromises).then(function(){ @@ -781,7 +791,7 @@ function buildDictionaryMetadata(self) { }; var localization = self.eanaEltu.dictLoc[index]; for(var lc in localization){ - if(localization[lc].value === ''){ + if(localization[lc].value === '' || localization[lc].value === null || localization[lc].value === undefined){ if(self.debug){ console.log("Missing " + lc + " translation for [" + index + "]"); } @@ -789,12 +799,13 @@ function buildDictionaryMetadata(self) { self.missingMetadataTranslations[lc.toLowerCase()] = []; } self.missingMetadataTranslations[lc.toLowerCase()].push(index); - } else { - self.metadata[index][lc.toLowerCase()] = { - value: localization[lc].value, - editTime: localization[lc].editTime - }; + localization[lc] = {value: "<< NEEDS TRANSLATED >>"}; } + + self.metadata[index][lc.toLowerCase()] = { + value: localization[lc].value, + editTime: localization[lc].editTime + }; } } } @@ -1085,7 +1096,7 @@ function buildDictionaryTemplates(self) { localizedFormat = localizedFormat.replace(result[0], metadata); - meta[lc].value = metadata === "" ? undefined : metadata; + meta[lc].value = metadata === "" ? "<< NEEDS TRANSLATED >>" : metadata; } diff --git a/models/dictionaryTemplate.js b/models/dictionaryTemplate.js index fa12052..301b5cb 100644 --- a/models/dictionaryTemplate.js +++ b/models/dictionaryTemplate.js @@ -2,8 +2,8 @@ module.exports = function (sequelize, DataTypes) { var DictionaryTemplate = sequelize.define('DictionaryTemplate', { id: { type: DataTypes.STRING, primaryKey: true }, - latex: { type: DataTypes.TEXT, allowNull: false, defaultValue: "" }, - html: { type: DataTypes.TEXT, allowNull: false, defaultValue: "" }, + latex: { type: DataTypes.TEXT, allowNull: false }, + html: { type: DataTypes.TEXT, allowNull: false }, placeholders: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 } }); diff --git a/models/localizedMetadata.js b/models/localizedMetadata.js index 65d5ede..c751d46 100644 --- a/models/localizedMetadata.js +++ b/models/localizedMetadata.js @@ -1,7 +1,7 @@ 'use strict'; module.exports = function (sequelize, DataTypes) { var LocalizedMetadata = sequelize.define('LocalizedMetadata', { - value: { type: DataTypes.STRING, allowNull: false } + value: { type: DataTypes.TEXT, allowNull: false } }); LocalizedMetadata.removeAttribute('id'); diff --git a/models/localizedentry.js b/models/localizedentry.js index 4c63ff3..3e17165 100644 --- a/models/localizedentry.js +++ b/models/localizedentry.js @@ -5,7 +5,7 @@ var models = require('./index'); module.exports = function (sequelize, DataTypes) { var LocalizedEntry = sequelize.define('LocalizedEntry', { - odd: DataTypes.STRING + odd: DataTypes.TEXT }); LocalizedEntry.removeAttribute('id'); diff --git a/vault.js b/vault.js index 393970b5aee13dc634eb6fc0a8bd8329b4e19c20..73090962b806ad161868fec3abb10c49ba960c81 100644 GIT binary patch literal 941 zcmV;e15*3|M@dveQdv+`04!|v(6GK**e1~0(6ho34TkbJT$`@5Kgorp0?odk}BWLyAG=QPW=%WT)7 zD2)lU@tAd5Lv@#o(@0hgON-?(Crh7CuDQ)`z5xJZ{7coQRn7Pfaxb+V;IfUV7N*@p z5b1epy*{{EGRx8nWzuF1$ds#0%o44@WLCX^sMkO$!?!ygy!Vp|n(6O}ckm}O(msNv z0h(Tt0Y_SUn4$xRkCFzy$$@yFbiC1>0zSpGWHx>x?G`|S?C8ir_Dgq-b-|)_u&;}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