Fixes for back translations
This commit is contained in:
@@ -291,11 +291,17 @@ module.exports = function (options) {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
association: db.TranslationArtifactVersion.BackTranslation,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}).then((translationArtifactVersion) => {
|
}).then((translationArtifactVersion) => {
|
||||||
if (translationArtifactVersion) {
|
if (translationArtifactVersion) {
|
||||||
// TODO: Create a backTranslation...
|
if (translationArtifactVersion.backTranslation) {
|
||||||
|
// translationArtifactVersion has a back translation...xx§
|
||||||
|
return translationArtifactVersion.backTranslation
|
||||||
|
} else {
|
||||||
return db.TranslationArtifactVersion.create({
|
return db.TranslationArtifactVersion.create({
|
||||||
creatorId: request.user.id,
|
creatorId: request.user.id,
|
||||||
name: translationArtifactVersion.artifactVersion.artifact.dialect.name,
|
name: translationArtifactVersion.artifactVersion.artifact.dialect.name,
|
||||||
@@ -329,6 +335,7 @@ module.exports = function (options) {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -336,8 +343,7 @@ module.exports = function (options) {
|
|||||||
if (translationArtifactVersion) {
|
if (translationArtifactVersion) {
|
||||||
response.redirect(`/translate/${translationArtifactVersion.id}`)
|
response.redirect(`/translate/${translationArtifactVersion.id}`)
|
||||||
} else {
|
} else {
|
||||||
// TODO: Let user know we cannot back translate
|
next()
|
||||||
|
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
next(error)
|
next(error)
|
||||||
|
|||||||
@@ -21,7 +21,11 @@ module.exports = function (options) {
|
|||||||
association: db.ArtifactVersion.Chapters
|
association: db.ArtifactVersion.Chapters
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
association: db.ArtifactVersion.TranslationArtifactVersions
|
association: db.ArtifactVersion.TranslationArtifactVersions,
|
||||||
|
where: {
|
||||||
|
backTranslationFromId: null
|
||||||
|
},
|
||||||
|
required: false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}).then(artifactVersion => {
|
}).then(artifactVersion => {
|
||||||
|
|||||||
Reference in New Issue
Block a user