diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..85266ff985a71c7c1d0a0933785b77be4d3d3c3d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +services: + simcaq-node: + container_name: simcaq-node + build: . + ports: + - '3000:3000' + develop: + watch: + - action: sync + path: . + target: /API diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..04db51922c7afe6455aa25ef452e79ead0cd5751 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/bash +echo "Starting simcaq-node" +gulp watch &> /dev/null & +cd build +NODE_ENV=production gulp run diff --git a/gulpfile.babel.js b/gulpfile.babel.js index c661d5af261b6a5a8baf5232592d01ef7cb48b28..1d0724e16a18a88b11333f3564a763ebe1452d83 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -43,12 +43,12 @@ gulp.task('compile', ['lint'], () => { gulp.src('src/**/*.js') .pipe(cache.filter()) // cache source files .pipe(babel()) // compile only modified files - // .pipe(cache.cache()) // cache compiled files + .pipe(cache.cache()) // cache compiled files .pipe(gulp.dest('build')); // move compiled files to build directory }); gulp.task('build', ['compile'], () => { - var filesToCopy = [ 'config.json', 'package.json' ]; + var filesToCopy = [ 'config.json', 'package.json', '.eslintignore', '.eslintrc.json' ]; // copy configuration file to build directory gulp.src(filesToCopy) .pipe(gulp.dest('build')); @@ -93,24 +93,16 @@ gulp.task('test', ['pre-test'], () => { }); }); -gulp.task('watch', ['compile'], () => { +gulp.task('watch', () => { console.log('Watching source directory for changes'); - gulp.watch('src/**/*.js').on('change', () => { + return gulp.watch('src/**/*.js').on('change', () => { console.log('Recompiling source'); gulp.start('compile'); console.log('Source recompilation done'); }); }); -gulp.task('run', () => { - process.chdir('build'); - nodemon({ - script: 'server.js', - tasks: ['watch'], - ignore: ["test/test.js", "gulpfile.babel.js"], - ext: 'js html json', - env: { 'NODE_ENV': process.env.NODE_ENV } - }); +gulp.task('default', () => { + console.log("Não execuatar apenas gulp, execute da forma:"); + console.log("\t\tgulp <task>"); }); - -gulp.task('default', ['run']); diff --git a/gulpfile.template.js b/gulpfile.template.js new file mode 100644 index 0000000000000000000000000000000000000000..3de679df0c18e307b692cb22a3cb6446c052fcaf --- /dev/null +++ b/gulpfile.template.js @@ -0,0 +1,20 @@ +const gulp = require('gulp'); + +const nodemon = require('gulp-nodemon'); + +gulp.task('run', () => { + // process.chdir('build'); + nodemon({ + script: 'server.js', + // tasks: ['watch'], + ignore: ["test/test.js", "gulpfile.babel.js"], + ext: 'js html json', + env: { 'NODE_ENV': process.env.NODE_ENV } + }); +}); + +gulp.task('default', () => { + console.log("Não execuatar apenas gulp, execute da forma:"); + console.log("\t\tgulp <task>"); +}); + diff --git a/src/libs/routes_v1/studentsReceivingAidTax.js b/src/libs/routes_v1/studentsReceivingAidTax.js index 3603888e71fa7b1ed317de51ee1a4ce8912c6eb1..c4509cf84057b5243e9e93f2ae7ccfc992e00a47 100644 --- a/src/libs/routes_v1/studentsReceivingAidTax.js +++ b/src/libs/routes_v1/studentsReceivingAidTax.js @@ -566,8 +566,11 @@ function matchQueries(queryPartial, queryTotal) { if(objMatch) { newObj.denominator = result.total; + newObj.denominator = Number(newObj.denominator.toFixed(2)); newObj.partial = objMatch.total; + newObj.partial = Number(newObj.total.toFixed(2)); newObj.total = (objMatch.total / result.total) * 100; + newObj.total = Number(newObj.total.toFixed(2)); match.push(newObj); } });