Skip to content
Snippets Groups Projects
Commit 4c9ec40f authored by Pietro Cavassin's avatar Pietro Cavassin
Browse files

add nao classificada to school

parent 6a86cc45
No related branches found
No related tags found
3 merge requests!329Update enrollment - new filters,!309Merge new updates into master,!308Issue792 pietro
......@@ -12,6 +12,11 @@ const nullFields = [
]
function parseWhereValue(type, value, relation) {
if (value == null)
return null;
if (value.toString().toLowerCase() == "null")
return null;
if(type === 'integer') return parseInt(value, 10);
if(type === 'double') return parseFloat(value);
if(type === 'string' && relation === 'LIKE') return '%'+value+'%';
......@@ -21,12 +26,8 @@ function parseWhereValue(type, value, relation) {
return value;
}
if(typeof value === 'string') {
if(value.toLowerCase() === 'true' || value.toLowerCase() === '1') {
if(value.toLowerCase() === 'true' || value.toLowerCase() === '1')
return true;
}
if(value.toLowerCase() === 'null') {
return null;
}
}
return false;
}
......@@ -42,9 +43,12 @@ function getConvertName(whereField){ // TODO: mudar para regex
}
function isNull(curFilter, value){
if (value == null)
return true;
let convertName = getConvertName(curFilter)
if (id2str[convertName] !== undefined)
if (id2str[convertName] !== undefined){
return nullFields.indexOf(id2str[convertName](value)) > -1
}
return false;
}
......@@ -328,7 +332,7 @@ class ReqQueryFields {
for(let i = 0; i < whereValue.length; ++i) {
let curRelation = value.where.relation;
let curValue = parseWhereValue(value.where.type, whereValue[i],value.where.relation)
if (isNull(k, curValue) ) {
if (isNull(k, curValue)) {
curValue = null;
curRelation = "is";
}
......
......@@ -92,8 +92,11 @@ schoolApp.get('/adm_dependency_detailed', cache('15 day'), (req, res, next) => {
}, response('adm_dependency_detailed'));
schoolApp.get('/government_agreement', cache('15 day'), (req, res, next) => {
req.result = [];
for(let i = 1; i <= 7; ++i) {
req.result = [{
id: "null",
name: id2str.governmentAgreement("null")
}];
for(let i = 1; i <= 6; ++i) {
req.result.push({
id: i,
name: id2str.governmentAgreement(i)
......@@ -497,8 +500,8 @@ rqfCount.addField({
resultField: 'government_agreement_id',
where: {
relation: '=',
type: 'boolean',
field: 'conveniada_pp'
type: 'integer',
field: 'dependencia_convenio_publico'
}
}).addValue({
name: 'integral_time',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment