Skip to content

Commit

Permalink
fix typos and dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Aug 29, 2016
1 parent bfe4866 commit 4c56a2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/cli/helpers/abe-sql.js
Expand Up @@ -235,8 +235,8 @@ export default class Sql {
var reg = /([^'"]*=[\s\S]*?}})/g
var matches = res.match(reg)
if(typeof matches !== 'undefined' && matches !== null) {
Array.prototype.forEach.call(matches, (matche) => {
res = res.replace(matche, '')
Array.prototype.forEach.call(matches, (match) => {
res = res.replace(match, '')
})
}else {
res = res.replace('}}', '')
Expand Down Expand Up @@ -322,7 +322,7 @@ export default class Sql {
return files
}

static getDataRequest(path, match, jsonPage) {
static executeQuery(path, match, jsonPage) {
var p = new Promise((resolve, reject) => {
var res = []
var files = []
Expand Down
20 changes: 2 additions & 18 deletions src/cli/helpers/abe-utils.js
Expand Up @@ -311,19 +311,16 @@ export default class Utils {

switch (type) {
case 'request':
//console.log(obj.sourceString)
Sql.getDataRequest(tplPath, match[0], jsonPage)
Sql.executeQuery(tplPath, match[0], jsonPage)
.then((data) => {
//console.log('FIN : ' + type + "(" + data.length +") > " + ((new Date().getTime() - dateStart.getTime()) / 1000))
jsonPage[sourceAttr][obj.key] = data
if (!obj.editable) {
if (obj.maxLength) {
jsonPage[obj.key] = data.slice(0, obj.maxLength)
}else {
jsonPage[obj.key] = data
}
}else if (obj.prefill) {
// console.log("msg")
} else if (obj.prefill) {
if (obj.prefillQuantity && obj.maxLength) {
jsonPage[obj.key] = data.slice(0, (obj.prefillQuantity > obj.maxLength) ? obj.maxLength : obj.prefillQuantity)
}else if (obj.prefillQuantity) {
Expand All @@ -333,7 +330,6 @@ export default class Utils {
}else {
jsonPage[obj.key] = data
}
// console.log(obj.key, jsonPage[obj.key])
}

if(typeof obj.paginate !== 'undefined' && obj.paginate !== null && obj.paginate !== '') {
Expand Down Expand Up @@ -378,18 +374,6 @@ export default class Utils {
jsonPage = Hooks.instance.trigger('beforePaginateEditor', jsonPage, obj)
}

if(typeof jsonPage[obj.key] !== 'undefined' && jsonPage[obj.key] !== null) {
var newJsonValue = []
Array.prototype.forEach.call(jsonPage[obj.key], (oldValue) => {
Array.prototype.forEach.call(jsonPage[sourceAttr][obj.key], (newValue) => {
if(typeof oldValue[config.meta.name] !== 'undefined' && oldValue[config.meta.name] !== null
&& oldValue[config.meta.name].link === newValue[config.meta.name].link) {
newJsonValue.push(newValue)
}
})
})
}

log.duration(type + " > " + logTime, ((new Date().getTime() - dateStart.getTime()) / 1000))

resolveSource()
Expand Down

0 comments on commit 4c56a2f

Please sign in to comment.