From 6490dffba23c2b91aed1744be1ff45e8b2a499f7 Mon Sep 17 00:00:00 2001 From: edsaibert <es23@inf.ufpr.br> Date: Wed, 15 Jan 2025 11:35:28 -0300 Subject: [PATCH] rounding match queries --- docker-compose.yml | 11 ++++++++++ entrypoint.sh | 5 +++++ gulpfile.babel.js | 22 ++++++------------- gulpfile.template.js | 20 +++++++++++++++++ src/libs/routes_v1/studentsReceivingAidTax.js | 3 +++ 5 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 docker-compose.yml create mode 100644 entrypoint.sh create mode 100644 gulpfile.template.js diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..85266ff9 --- /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 00000000..04db5192 --- /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 c661d5af..1d0724e1 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 00000000..3de679df --- /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 3603888e..c4509cf8 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); } }); -- GitLab