From 0860bf39fa97aedba9ccf6a119ef99f509f0f85a Mon Sep 17 00:00:00 2001 From: Lakshamana Date: Wed, 12 Jun 2019 23:30:13 -0300 Subject: [PATCH 01/22] =?UTF-8?q?Cria=20bot=C3=A3o=20e=20modal=20de=20pend?= =?UTF-8?q?=C3=AAncias?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/studentComboBox.vue | 70 ++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 7 deletions(-) diff --git a/components/studentComboBox.vue b/components/studentComboBox.vue index 09fa64a4..2b7c6298 100644 --- a/components/studentComboBox.vue +++ b/components/studentComboBox.vue @@ -54,12 +54,33 @@ @blur="onCrgBlur" >
- Componentes Pendentes: - + + {{ !canEdit ? 'Verificar Pendências' : 'Editar Pendências' }} + + +
+
+ +

Pendências

+
+
+
+
+ +
+ Confirmar +
+
+
+

@@ -242,12 +263,14 @@ export default { ataCheck: false, laudaCheck: false, presCheck: false, + editPendencies: false, ataDocument: {}, laudaDocument: {}, presDocument: {}, uploadFile: File, crg: '', - pendencies: '', + totalPendencies: [], + studentPendencies: [], studentData: Object.assign({}, this.student), isLoading: false, defenseDate: new Date() @@ -375,6 +398,39 @@ export default { toggleEdit() { this.canEdit = !this.canEdit }, + getPendencies() { + this.$axios + .get('/api/pendencies') + .then(response => { + this.totalPendencies = response.data + }) + .catch(e => { + this.editPendencies = false + this.openErrorNotification(e) + }) + + this.$axios + .get(`/api/students/${this.student.id}/pendencies`) + .then(response => { + this.studentPendencies = response.data + }) + .catch(e => this.openErrorNotification(e)) + }, + updatePendencies() { + this.$axios + .post( + `/api/students/${this.student.id}/pendencies`, + this.studentPendencies + ) + .then(response => { + this.$toast.open({ + message: 'Pendências de aluno atualizadas com sucesso', + type: 'is-success' + }) + }) + .catch(e => this.openErrorNotification(e)) + this.editPendencies = false + }, mapDocuments(documents) { documents.forEach(element => { if (element.type === 1) { From 6523a56d6e7687b1dd8eb0423cc735b8776950e7 Mon Sep 17 00:00:00 2001 From: Lakshamana Date: Thu, 13 Jun 2019 11:29:17 -0300 Subject: [PATCH 02/22] =?UTF-8?q?Adiciona=20tabela=20para=20crud=20de=20ma?= =?UTF-8?q?t=C3=A9rias?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/studentComboBox.vue | 43 +++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/components/studentComboBox.vue b/components/studentComboBox.vue index 2b7c6298..d4716fa3 100644 --- a/components/studentComboBox.vue +++ b/components/studentComboBox.vue @@ -57,7 +57,7 @@ {{ !canEdit ? 'Verificar Pendências' : 'Editar Pendências' }} - +
@@ -65,17 +65,24 @@
-
- -
+ + + + + + + +
{{ pendency.name }} + +
Confirmar
@@ -263,7 +270,7 @@ export default { ataCheck: false, laudaCheck: false, presCheck: false, - editPendencies: false, + showPendencies: false, ataDocument: {}, laudaDocument: {}, presDocument: {}, @@ -405,7 +412,7 @@ export default { this.totalPendencies = response.data }) .catch(e => { - this.editPendencies = false + this.showPendencies = false this.openErrorNotification(e) }) @@ -413,8 +420,12 @@ export default { .get(`/api/students/${this.student.id}/pendencies`) .then(response => { this.studentPendencies = response.data + this.showPendencies = true + }) + .catch(e => { + this.showPendencies = false + this.openErrorNotification(e) }) - .catch(e => this.openErrorNotification(e)) }, updatePendencies() { this.$axios @@ -429,7 +440,7 @@ export default { }) }) .catch(e => this.openErrorNotification(e)) - this.editPendencies = false + this.showPendencies = false }, mapDocuments(documents) { documents.forEach(element => { From 947baf45afdc71dfa3e6f0399c89b8966e3c72a5 Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Thu, 6 Jun 2019 18:09:03 -0300 Subject: [PATCH 03/22] Adiciona tabela e seed para Pendency --- migrations/20190605024900_pendencies.js | 25 ++++++++++++++++ seeds/pendencies.js | 39 +++++++++++++++++++++++++ server/models/Pendency.js | 7 +++++ 3 files changed, 71 insertions(+) create mode 100644 migrations/20190605024900_pendencies.js create mode 100644 seeds/pendencies.js create mode 100644 server/models/Pendency.js diff --git a/migrations/20190605024900_pendencies.js b/migrations/20190605024900_pendencies.js new file mode 100644 index 00000000..72baeb62 --- /dev/null +++ b/migrations/20190605024900_pendencies.js @@ -0,0 +1,25 @@ +exports.up = function(knex, Promise) { + return knex.schema.createTable('pendencies', table => { + table.increments('id').primary() + table + .integer('studentId') + .unsigned() + .notNullable() + table + .foreign('studentId') + .references('id') + .inTable('students') + table + .integer('subjectId') + .unsigned() + .notNullable() + table + .foreign('subjectId') + .references('id') + .inTable('subjects') + }) +} + +exports.down = function(knex, Promise) { + return knex.schema.dropTable('pendencies') +} diff --git a/seeds/pendencies.js b/seeds/pendencies.js new file mode 100644 index 00000000..49d44cef --- /dev/null +++ b/seeds/pendencies.js @@ -0,0 +1,39 @@ +const Pendency = require('../server/models/Pendency') + +exports.seed = async function(knex, Promise) { + // Deletes ALL existing entries + await knex('pendencies').del() + + const data = [ + { + studentId: 1, + subjectId: 1 + }, + { + studentId: 1, + subjectId: 2 + }, + { + studentId: 1, + subjectId: 3 + }, + { + studentId: 2, + subjectId: 1 + }, + { + studentId: 3, + subjectId: 1 + }, + { + studentId: 3, + subjectId: 3 + }, + { + studentId: 5, + subjectId: 6 + } + ] + + return Promise.all(data.map(pendency => Pendency.forge(pendency).save())) +} diff --git a/server/models/Pendency.js b/server/models/Pendency.js new file mode 100644 index 00000000..3dda31e4 --- /dev/null +++ b/server/models/Pendency.js @@ -0,0 +1,7 @@ +const { bookshelf } = require('../db') + +const Pendency = bookshelf.model('Pendency', { + tableName: 'pendencies' +}) + +module.exports = Pendency From 1c98d6b8046c082321c7ac5a187ea7bbaf473d21 Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Thu, 6 Jun 2019 20:28:27 -0300 Subject: [PATCH 04/22] Teste para tabela --- test/server/models/pendencies.spec.js | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/server/models/pendencies.spec.js diff --git a/test/server/models/pendencies.spec.js b/test/server/models/pendencies.spec.js new file mode 100644 index 00000000..6b22510f --- /dev/null +++ b/test/server/models/pendencies.spec.js @@ -0,0 +1,36 @@ +/** + * @jest-environment node + */ + +const chai = require('chai') +const chaiHttp = require('chai-http') +chai.use(chaiHttp) + +const db = require('../../../server/db') +const Pendency = require('../../../server/models/Pendency') + +jest.useFakeTimers() + +describe('/api/students/:idStudent/pendencies', () => { + beforeEach(async done => { + await db.knex.migrate.rollback() + await db.knex.migrate.latest() + await db.knex.seed.run() + done() + }, 100000) + + afterEach(() => { + return db.knex.migrate.rollback() + }) + + test('Create a Pendency', async done => { + const pendency = await Pendency.forge({ + studentId: 1, + subjectId: 10 + }).save() + expect(pendency.id).toBeDefined() + expect(pendency.attributes.studentId).toEqual(1) + expect(pendency.attributes.subjectId).toEqual(10) + done() + }) +}) From c73c0cfb4d62236245c80c87bb90114fe61a2771 Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Sat, 8 Jun 2019 02:29:45 -0300 Subject: [PATCH 05/22] Atualiza regra para tabela de pendencias --- migrations/20190605024900_pendencies.js | 1 + 1 file changed, 1 insertion(+) diff --git a/migrations/20190605024900_pendencies.js b/migrations/20190605024900_pendencies.js index 72baeb62..3b635ba8 100644 --- a/migrations/20190605024900_pendencies.js +++ b/migrations/20190605024900_pendencies.js @@ -17,6 +17,7 @@ exports.up = function(knex, Promise) { .foreign('subjectId') .references('id') .inTable('subjects') + table.unique(['studentId', 'subjectId']) }) } From 4c2d4147b21e17514bf83866d72575d69cf03517 Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Sat, 8 Jun 2019 02:30:11 -0300 Subject: [PATCH 06/22] Adiciona rotas de de pendencias [em progresso] --- server/controllers/pendencies/List.js | 27 ++++++++++++++++++++++++++ server/controllers/pendencies/Show.js | 26 +++++++++++++++++++++++++ server/controllers/pendencies/index.js | 4 ++++ server/router.js | 4 ++++ 4 files changed, 61 insertions(+) create mode 100644 server/controllers/pendencies/List.js create mode 100644 server/controllers/pendencies/Show.js create mode 100644 server/controllers/pendencies/index.js diff --git a/server/controllers/pendencies/List.js b/server/controllers/pendencies/List.js new file mode 100644 index 00000000..6f3c99f4 --- /dev/null +++ b/server/controllers/pendencies/List.js @@ -0,0 +1,27 @@ +const errors = require('../../../shared/errors') + +const Students = require('../../models/Student') +const Pendencies = require('../../models/Pendency') +const Subjects = require('../../models/Subject') + +module.exports = async function listPendencies(ctx) { + const { studentId } = ctx.params + + if ((await Students.where('id', studentId).count()) === 0) { + ctx.status = 404 + ctx.body = { code: errors.NOT_FOUND } + return + } + + if ((await Pendencies.where({ studentId }).count()) === 0) { + ctx.status = 404 + ctx.body = { code: errors.NOT_FOUND } + return + } + + const subjectsIds = await Pendencies.where({ studentId }) + .fetchAll() + .then(collection => collection.map(pendency => pendency.get('subjectId'))) + + ctx.body = await Subjects.where('id', 'in', subjectsIds).fetchAll() +} diff --git a/server/controllers/pendencies/Show.js b/server/controllers/pendencies/Show.js new file mode 100644 index 00000000..77dfbd7a --- /dev/null +++ b/server/controllers/pendencies/Show.js @@ -0,0 +1,26 @@ +const errors = require('../../../shared/errors') + +const Students = require('../../models/Student') +const Pendencies = require('../../models/Pendency') +const Subjects = require('../../models/Subject') + +module.exports = async function showPendency(ctx) { + const { studentId, id } = ctx.params + + if ((await Students.where('id', studentId).count()) === 0) { + ctx.status = 404 + ctx.body = { code: errors.NOT_FOUND } + return + } + + if ( + (await Pendencies.where({ studentId, subjectId: id }).count()) === 0 || + (await Subjects.where({ id }).count()) === 0 + ) { + ctx.status = 404 + ctx.body = { code: errors.NOT_FOUND } + return + } + + ctx.body = await Subjects.where({ id }).fetch() +} diff --git a/server/controllers/pendencies/index.js b/server/controllers/pendencies/index.js new file mode 100644 index 00000000..84e7f33c --- /dev/null +++ b/server/controllers/pendencies/index.js @@ -0,0 +1,4 @@ +const Show = require('./Show') +const List = require('./List') + +module.exports = { Show, List } diff --git a/server/router.js b/server/router.js index 9440af96..7afced69 100644 --- a/server/router.js +++ b/server/router.js @@ -10,6 +10,7 @@ const students = require('./controllers/students') const subjects = require('./controllers/subjects') const auth = require('./controllers/auth') const solicitations = require('./controllers/solicitations') +const pendencies = require('./controllers/pendencies') const router = new Router() const api = new Router({ prefix: '/api' }) @@ -45,6 +46,9 @@ api.get('/students/:studentId/documents/:id', documents.Show) api.get('/students/:studentId/documents/:id/view', documents.View) api.post('/students/:studentId/documents', bodyMultipart, documents.Upload) api.post('/students/from-csv', bodyMultipart, students.FromCsv) +// Pendencies Routes +api.get('/students/:studentId/pendencies/:id', pendencies.Show) +api.get('/students/:studentId/pendencies/', pendencies.List) // Subjects Routes api.get('/subjects/', subjects.List) api.get('/subjects/:id', subjects.Show) From 94ee0b34904d39999d33f68af8dcb3c8ac290905 Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Thu, 13 Jun 2019 10:43:39 -0300 Subject: [PATCH 07/22] =?UTF-8?q?Remove=20retorno=20404=20para=20aus=C3=AA?= =?UTF-8?q?ncia=20de=20pend=C3=AAncias?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/controllers/pendencies/List.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/server/controllers/pendencies/List.js b/server/controllers/pendencies/List.js index 6f3c99f4..ae3525ef 100644 --- a/server/controllers/pendencies/List.js +++ b/server/controllers/pendencies/List.js @@ -13,12 +13,6 @@ module.exports = async function listPendencies(ctx) { return } - if ((await Pendencies.where({ studentId }).count()) === 0) { - ctx.status = 404 - ctx.body = { code: errors.NOT_FOUND } - return - } - const subjectsIds = await Pendencies.where({ studentId }) .fetchAll() .then(collection => collection.map(pendency => pendency.get('subjectId'))) From db50ace2625c7dba09091655f53deb312a7b39f2 Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Thu, 13 Jun 2019 12:45:35 -0300 Subject: [PATCH 08/22] =?UTF-8?q?Adiciona=20testes=20para=20requisi=C3=A7?= =?UTF-8?q?=C3=B5es=20de=20pendencias?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/server/controllers/pendencies.spec.js | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 test/server/controllers/pendencies.spec.js diff --git a/test/server/controllers/pendencies.spec.js b/test/server/controllers/pendencies.spec.js new file mode 100644 index 00000000..dadeadb7 --- /dev/null +++ b/test/server/controllers/pendencies.spec.js @@ -0,0 +1,76 @@ +/** + * @jest-environment node + */ + +const chai = require('chai') +const chaiHttp = require('chai-http') +chai.use(chaiHttp) + +const testUtils = require('../test-utils') +const server = require('../../../server') +const db = require('../../../server/db') +const errors = require('../../../shared/errors') + +jest.useFakeTimers() +describe('/api/students/:id/pendencies/', () => { + beforeEach(async () => { + await db.knex.migrate.rollback() + await db.knex.migrate.latest() + await db.knex.seed.run() + }, 100000) + + test('GET /students/1/pendencies/', async done => { + const { token } = await testUtils.user('admin') + const res = await chai + .request(server.listen()) + .get('/api/students/1/pendencies/') + .set('Authorization', `Bearer ${token}`) + expect(res.body).toBeDefined() + expect(res.type).toEqual('application/json') + expect(res.status).toEqual(200) + expect(res.body.length).toEqual(3) + expect(res.body[0].name).toEqual('ALGEBRA LINEAR PARA COMPUTACAO') + expect(res.body[1].name).toEqual('CALCULO COMPUTACIONAL I') + expect(res.body[2].name).toEqual('FISICA PARA COMPUTACAO') + done() + }) + + test('GET /students/1/pendencies/1', async done => { + const { token } = await testUtils.user('admin') + const res = await chai + .request(server.listen()) + .get('/api/students/1/pendencies/1') + .set('Authorization', `Bearer ${token}`) + expect(res.body).toBeDefined() + expect(res.type).toEqual('application/json') + expect(res.status).toEqual(200) + expect(res.body.name).toEqual('ALGEBRA LINEAR PARA COMPUTACAO') + done() + }) + + test('GET /students/1000/pendencies/1 NOT FOUND STUDENT', async done => { + const { token } = await testUtils.user('admin') + const res = await chai + .request(server.listen()) + .get('/api/students/1000/pendencies/1') + .set('Authorization', `Bearer ${token}`) + expect(res.body).toBeDefined() + expect(res.type).toEqual('application/json') + expect(res.status).toEqual(404) + expect(res.body.code).toEqual(errors.NOT_FOUND) + done() + }) + + test('GET /students/1/pendencies/1000 NOT FOUND PENDENCY', async done => { + const { token } = await testUtils.user('admin') + const res = await chai + .request(server.listen()) + .get('/api/students/1/pendencies/1000') + .set('Authorization', `Bearer ${token}`) + expect(res.body).toBeDefined() + expect(res.type).toEqual('application/json') + expect(res.status).toEqual(404) + expect(res.body.code).toEqual(errors.NOT_FOUND) + done() + }) +}) From 2e2d5f5a566d6170eda570cf0b9f77526277a34e Mon Sep 17 00:00:00 2001 From: Lakshamana Date: Thu, 13 Jun 2019 15:23:37 -0300 Subject: [PATCH 09/22] =?UTF-8?q?Enviar=20POST=20apenas=20em=20=20modo=20d?= =?UTF-8?q?e=20edi=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/studentComboBox.vue | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/components/studentComboBox.vue b/components/studentComboBox.vue index d4716fa3..65cee775 100644 --- a/components/studentComboBox.vue +++ b/components/studentComboBox.vue @@ -407,7 +407,7 @@ export default { }, getPendencies() { this.$axios - .get('/api/pendencies') + .get('/api/subjects') .then(response => { this.totalPendencies = response.data }) @@ -428,18 +428,20 @@ export default { }) }, updatePendencies() { - this.$axios - .post( - `/api/students/${this.student.id}/pendencies`, - this.studentPendencies - ) - .then(response => { - this.$toast.open({ - message: 'Pendências de aluno atualizadas com sucesso', - type: 'is-success' + if (this.canEdit) { + this.$axios + .post( + `/api/students/${this.student.id}/pendencies`, + this.studentPendencies + ) + .then(response => { + this.$toast.open({ + message: 'Pendências de aluno atualizadas com sucesso', + type: 'is-success' + }) }) - }) - .catch(e => this.openErrorNotification(e)) + .catch(e => this.openErrorNotification(e)) + } this.showPendencies = false }, mapDocuments(documents) { From 496d247cde33e82655512bc09587343c740abac7 Mon Sep 17 00:00:00 2001 From: Lakshamana Date: Thu, 13 Jun 2019 16:51:46 -0300 Subject: [PATCH 10/22] =?UTF-8?q?Adiciona=20pagina=C3=A7=C3=A3o=20para=20p?= =?UTF-8?q?end=C3=AAncias?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/studentComboBox.vue | 51 ++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/components/studentComboBox.vue b/components/studentComboBox.vue index 65cee775..b8554f26 100644 --- a/components/studentComboBox.vue +++ b/components/studentComboBox.vue @@ -65,8 +65,8 @@
- - +
+
Confirmar +
+ +
@@ -280,7 +292,9 @@ export default { studentPendencies: [], studentData: Object.assign({}, this.student), isLoading: false, - defenseDate: new Date() + defenseDate: new Date(), + currentPendenciesPage: 1, + totalPendenciesLength: 0 } }, computed: { @@ -349,6 +363,12 @@ export default { ) ) : null + this.$axios + .get(`/api/students/${this.student.id}/pendencies`) + .then(response => { + this.studentPendencies = response.data + }) + .catch(e => this.openErrorNotification(e)) }, methods: { @@ -407,19 +427,14 @@ export default { }, getPendencies() { this.$axios - .get('/api/subjects') - .then(response => { - this.totalPendencies = response.data - }) - .catch(e => { - this.showPendencies = false - this.openErrorNotification(e) + .get(`/api/subjects`, { + params: { + page: this.currentPendenciesPage + } }) - - this.$axios - .get(`/api/students/${this.student.id}/pendencies`) .then(response => { - this.studentPendencies = response.data + this.totalPendenciesLength = response.headers['pagination-row-count'] + this.totalPendencies = response.data this.showPendencies = true }) .catch(e => { @@ -444,6 +459,10 @@ export default { } this.showPendencies = false }, + onPageChange(page) { + this.currentPendenciesPage = page + this.getPendencies() + }, mapDocuments(documents) { documents.forEach(element => { if (element.type === 1) { @@ -547,4 +566,8 @@ export default { .icon { margin-left: 1em; } + +.scrollable { + overflow-y: scroll; +} From 565b9c9b4a29327ff4f001aa1f19c770c380741b Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Thu, 13 Jun 2019 15:52:42 -0300 Subject: [PATCH 11/22] Adiciona teste GET para pendencies --- test/server/controllers/pendencies.spec.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/server/controllers/pendencies.spec.js b/test/server/controllers/pendencies.spec.js index dadeadb7..fbebd3af 100644 --- a/test/server/controllers/pendencies.spec.js +++ b/test/server/controllers/pendencies.spec.js @@ -73,4 +73,17 @@ describe('/api/students/:id/pendencies/', () => { expect(res.body.code).toEqual(errors.NOT_FOUND) done() }) + + test('GET /students/4/pendencies/ NO PENDENCIES', async done => { + const { token } = await testUtils.user('admin') + const res = await chai + .request(server.listen()) + .get('/api/students/4/pendencies/') + .set('Authorization', `Bearer ${token}`) + expect(res.body).toBeDefined() + expect(res.type).toEqual('application/json') + expect(res.status).toEqual(200) + expect(res.body.length).toEqual(0) + done() + }) }) From 3264a941189ab35891bc5594c83a7587b64a2643 Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Thu, 13 Jun 2019 22:41:23 -0300 Subject: [PATCH 12/22] =?UTF-8?q?Utiliza=20transa=C3=A7=C3=A3o=20para=20jo?= =?UTF-8?q?in=20de=20Subjects=20e=20Students?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/controllers/pendencies/List.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/server/controllers/pendencies/List.js b/server/controllers/pendencies/List.js index ae3525ef..95fa63ee 100644 --- a/server/controllers/pendencies/List.js +++ b/server/controllers/pendencies/List.js @@ -1,4 +1,5 @@ const errors = require('../../../shared/errors') +const { knex } = require('../../db') const Students = require('../../models/Student') const Pendencies = require('../../models/Pendency') @@ -13,9 +14,14 @@ module.exports = async function listPendencies(ctx) { return } - const subjectsIds = await Pendencies.where({ studentId }) - .fetchAll() - .then(collection => collection.map(pendency => pendency.get('subjectId'))) + ctx.body = await knex.transaction(async trx => { + const subjectsIds = await Pendencies.where({ studentId }) + .fetchAll({ transacting: trx }) + .then(collection => collection.map(pendency => pendency.get('subjectId'))) - ctx.body = await Subjects.where('id', 'in', subjectsIds).fetchAll() + const subjectsFind = await Subjects.where('id', 'in', subjectsIds).fetchAll( + { transacting: trx } + ) + return subjectsFind + }) } From 57cf37d7167eb6d7c9103e848d94e5a9604e444a Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Thu, 13 Jun 2019 22:42:08 -0300 Subject: [PATCH 13/22] =?UTF-8?q?Rota=20para=20atualiza=C3=A7=C3=B5es=20de?= =?UTF-8?q?=20pend=C3=AAncias=20do=20estudante?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/controllers/pendencies/Update.js | 53 ++++++++++++++++++++++ server/controllers/pendencies/index.js | 3 +- server/router.js | 1 + test/server/controllers/pendencies.spec.js | 33 ++++++++++++++ 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 server/controllers/pendencies/Update.js diff --git a/server/controllers/pendencies/Update.js b/server/controllers/pendencies/Update.js new file mode 100644 index 00000000..830b05da --- /dev/null +++ b/server/controllers/pendencies/Update.js @@ -0,0 +1,53 @@ +const errors = require('../../../shared/errors') +const Students = require('../../models/Student') +const Pendencies = require('../../models/Pendency') +const Subjects = require('../../models/Subject') +const { knex } = require('../../db') + +module.exports = async function updatePendencies(ctx) { + const { studentId } = ctx.params + const subjects = ctx.request.body + + if ((await Students.where('id', studentId).count()) === 0) { + ctx.status = 404 + ctx.body = { code: errors.NOT_FOUND } + return + } + + const subjectsIdsReceived = subjects.map(subject => subject.id) + + await knex.transaction(async trx => { + const pendenciesExisting = await Pendencies.where({ studentId }).fetchAll({ + transacting: trx + }) + + const subjectsIdsExisting = pendenciesExisting.map(pend => + pend.get('subjectId') + ) + + const addPendencies = subjectsIdsReceived.filter( + id => !subjectsIdsExisting.includes(id) + ) + const delPendencies = pendenciesExisting.filter( + pendency => !subjectsIdsReceived.includes(pendency.get('subjectId')) + ) + const addPromises = addPendencies.map(subjectId => + new Pendencies({ subjectId, studentId }).save(null, { transacting: trx }) + ) + const delPromises = delPendencies.map(({ id }) => + Pendencies.where({ id }).destroy({ transacting: trx }) + ) + return Promise.all(addPromises.concat(delPromises)) + }) + + ctx.body = await knex.transaction(async trx => { + const subjectsIds = await Pendencies.where({ studentId }) + .fetchAll({ transacting: trx }) + .then(collection => collection.map(pendency => pendency.get('subjectId'))) + + const subjectsFind = await Subjects.where('id', 'in', subjectsIds).fetchAll( + { transacting: trx } + ) + return subjectsFind + }) +} diff --git a/server/controllers/pendencies/index.js b/server/controllers/pendencies/index.js index 84e7f33c..2574c54f 100644 --- a/server/controllers/pendencies/index.js +++ b/server/controllers/pendencies/index.js @@ -1,4 +1,5 @@ const Show = require('./Show') const List = require('./List') +const Update = require('./Update') -module.exports = { Show, List } +module.exports = { Show, List, Update } diff --git a/server/router.js b/server/router.js index 7afced69..b303b0db 100644 --- a/server/router.js +++ b/server/router.js @@ -49,6 +49,7 @@ api.post('/students/from-csv', bodyMultipart, students.FromCsv) // Pendencies Routes api.get('/students/:studentId/pendencies/:id', pendencies.Show) api.get('/students/:studentId/pendencies/', pendencies.List) +api.post('/students/:studentId/pendencies/', bodyJson, pendencies.Update) // Subjects Routes api.get('/subjects/', subjects.List) api.get('/subjects/:id', subjects.Show) diff --git a/test/server/controllers/pendencies.spec.js b/test/server/controllers/pendencies.spec.js index fbebd3af..ec4f6137 100644 --- a/test/server/controllers/pendencies.spec.js +++ b/test/server/controllers/pendencies.spec.js @@ -86,4 +86,37 @@ describe('/api/students/:id/pendencies/', () => { expect(res.body.length).toEqual(0) done() }) + + test('GET /students/1/pendencies/ UPDATE PENDENCIES', async done => { + const { token } = await testUtils.user('admin') + const res = await chai + .request(server.listen()) + .post('/api/students/1/pendencies/') + .set('Authorization', `Bearer ${token}`) + .send([ + { + id: 2, + name: 'CALCULO COMPUTACIONAL I' + }, + { + id: 3, + name: 'FISICA PARA COMPUTACAO' + }, + { + id: 4, + name: 'ALGORITMOS' + } + ]) + expect(res.body).toBeDefined() + expect(res.type).toEqual('application/json') + expect(res.status).toEqual(200) + expect(res.body.length).toEqual(3) + expect(res.body[0].id).toEqual(2) + expect(res.body[0].name).toEqual('CALCULO COMPUTACIONAL I') + expect(res.body[1].id).toEqual(3) + expect(res.body[1].name).toEqual('FISICA PARA COMPUTACAO') + expect(res.body[2].id).toEqual(4) + expect(res.body[2].name).toEqual('ALGORITMOS') + done() + }) }) From ada4ac46742a2875bd9bfa0e4fbbef93f343a503 Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Fri, 14 Jun 2019 03:21:47 -0300 Subject: [PATCH 14/22] =?UTF-8?q?Atendendo=20a=20revis=C3=B5es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/controllers/pendencies/List.js | 13 +------------ server/controllers/pendencies/Show.js | 10 ++++------ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/server/controllers/pendencies/List.js b/server/controllers/pendencies/List.js index 95fa63ee..77527c19 100644 --- a/server/controllers/pendencies/List.js +++ b/server/controllers/pendencies/List.js @@ -1,9 +1,7 @@ const errors = require('../../../shared/errors') -const { knex } = require('../../db') const Students = require('../../models/Student') const Pendencies = require('../../models/Pendency') -const Subjects = require('../../models/Subject') module.exports = async function listPendencies(ctx) { const { studentId } = ctx.params @@ -14,14 +12,5 @@ module.exports = async function listPendencies(ctx) { return } - ctx.body = await knex.transaction(async trx => { - const subjectsIds = await Pendencies.where({ studentId }) - .fetchAll({ transacting: trx }) - .then(collection => collection.map(pendency => pendency.get('subjectId'))) - - const subjectsFind = await Subjects.where('id', 'in', subjectsIds).fetchAll( - { transacting: trx } - ) - return subjectsFind - }) + ctx.body = await Pendencies.where({ studentId }).fetchAll() } diff --git a/server/controllers/pendencies/Show.js b/server/controllers/pendencies/Show.js index 77dfbd7a..2f48e645 100644 --- a/server/controllers/pendencies/Show.js +++ b/server/controllers/pendencies/Show.js @@ -2,7 +2,6 @@ const errors = require('../../../shared/errors') const Students = require('../../models/Student') const Pendencies = require('../../models/Pendency') -const Subjects = require('../../models/Subject') module.exports = async function showPendency(ctx) { const { studentId, id } = ctx.params @@ -13,14 +12,13 @@ module.exports = async function showPendency(ctx) { return } - if ( - (await Pendencies.where({ studentId, subjectId: id }).count()) === 0 || - (await Subjects.where({ id }).count()) === 0 - ) { + const pendencyFind = await Pendencies.where({ id }).fetch() + + if (pendencyFind === null) { ctx.status = 404 ctx.body = { code: errors.NOT_FOUND } return } - ctx.body = await Subjects.where({ id }).fetch() + ctx.body = pendencyFind } From 4eb3ac1775967e9374f1a044d49512981e544da1 Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Fri, 14 Jun 2019 03:23:58 -0300 Subject: [PATCH 15/22] =?UTF-8?q?Rota=20alternativa=20de=20acordo=20com=20?= =?UTF-8?q?revis=C3=A3o=20do=20Backend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/controllers/pendencies/Update.js | 16 ++-------------- server/router.js | 5 ++++- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/server/controllers/pendencies/Update.js b/server/controllers/pendencies/Update.js index 830b05da..29530114 100644 --- a/server/controllers/pendencies/Update.js +++ b/server/controllers/pendencies/Update.js @@ -1,12 +1,11 @@ const errors = require('../../../shared/errors') const Students = require('../../models/Student') const Pendencies = require('../../models/Pendency') -const Subjects = require('../../models/Subject') const { knex } = require('../../db') module.exports = async function updatePendencies(ctx) { const { studentId } = ctx.params - const subjects = ctx.request.body + const subjectsIdsReceived = ctx.request.body if ((await Students.where('id', studentId).count()) === 0) { ctx.status = 404 @@ -14,8 +13,6 @@ module.exports = async function updatePendencies(ctx) { return } - const subjectsIdsReceived = subjects.map(subject => subject.id) - await knex.transaction(async trx => { const pendenciesExisting = await Pendencies.where({ studentId }).fetchAll({ transacting: trx @@ -40,14 +37,5 @@ module.exports = async function updatePendencies(ctx) { return Promise.all(addPromises.concat(delPromises)) }) - ctx.body = await knex.transaction(async trx => { - const subjectsIds = await Pendencies.where({ studentId }) - .fetchAll({ transacting: trx }) - .then(collection => collection.map(pendency => pendency.get('subjectId'))) - - const subjectsFind = await Subjects.where('id', 'in', subjectsIds).fetchAll( - { transacting: trx } - ) - return subjectsFind - }) + ctx.body = await Pendencies.where({ studentId }).fetchAll() } diff --git a/server/router.js b/server/router.js index b303b0db..522d8536 100644 --- a/server/router.js +++ b/server/router.js @@ -40,16 +40,19 @@ api.put( students.UpdateAcademicHighlight ) api.put('/students/:id', bodyJson, students.Update) + // Documents Routes api.get('/students/:studentId/documents', documents.List) api.get('/students/:studentId/documents/:id', documents.Show) api.get('/students/:studentId/documents/:id/view', documents.View) api.post('/students/:studentId/documents', bodyMultipart, documents.Upload) api.post('/students/from-csv', bodyMultipart, students.FromCsv) + // Pendencies Routes api.get('/students/:studentId/pendencies/:id', pendencies.Show) api.get('/students/:studentId/pendencies/', pendencies.List) -api.post('/students/:studentId/pendencies/', bodyJson, pendencies.Update) +api.post('/students/:studentId/pendencies/batch', bodyJson, pendencies.Update) + // Subjects Routes api.get('/subjects/', subjects.List) api.get('/subjects/:id', subjects.Show) From 8b5819cdd0d5641e855e683d7a615eec5cfd8e11 Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Fri, 14 Jun 2019 03:49:09 -0300 Subject: [PATCH 16/22] Atualiza casos de teste --- test/server/controllers/pendencies.spec.js | 43 +++++++++------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/test/server/controllers/pendencies.spec.js b/test/server/controllers/pendencies.spec.js index ec4f6137..0489e10f 100644 --- a/test/server/controllers/pendencies.spec.js +++ b/test/server/controllers/pendencies.spec.js @@ -29,9 +29,12 @@ describe('/api/students/:id/pendencies/', () => { expect(res.type).toEqual('application/json') expect(res.status).toEqual(200) expect(res.body.length).toEqual(3) - expect(res.body[0].name).toEqual('ALGEBRA LINEAR PARA COMPUTACAO') - expect(res.body[1].name).toEqual('CALCULO COMPUTACIONAL I') - expect(res.body[2].name).toEqual('FISICA PARA COMPUTACAO') + expect(res.body[0].studentId).toEqual(1) + expect(res.body[0].subjectId).toEqual(1) + expect(res.body[1].studentId).toEqual(1) + expect(res.body[1].subjectId).toEqual(2) + expect(res.body[2].studentId).toEqual(1) + expect(res.body[2].subjectId).toEqual(3) done() }) @@ -44,7 +47,8 @@ describe('/api/students/:id/pendencies/', () => { expect(res.body).toBeDefined() expect(res.type).toEqual('application/json') expect(res.status).toEqual(200) - expect(res.body.name).toEqual('ALGEBRA LINEAR PARA COMPUTACAO') + expect(res.body.subjectId).toEqual(1) + expect(res.body.studentId).toEqual(1) done() }) @@ -87,36 +91,23 @@ describe('/api/students/:id/pendencies/', () => { done() }) - test('GET /students/1/pendencies/ UPDATE PENDENCIES', async done => { + test('POST /students/1/pendencies/batch UPDATE PENDENCIES', async done => { const { token } = await testUtils.user('admin') const res = await chai .request(server.listen()) - .post('/api/students/1/pendencies/') + .post('/api/students/1/pendencies/batch') .set('Authorization', `Bearer ${token}`) - .send([ - { - id: 2, - name: 'CALCULO COMPUTACIONAL I' - }, - { - id: 3, - name: 'FISICA PARA COMPUTACAO' - }, - { - id: 4, - name: 'ALGORITMOS' - } - ]) + .send([2, 3, 4]) expect(res.body).toBeDefined() expect(res.type).toEqual('application/json') expect(res.status).toEqual(200) expect(res.body.length).toEqual(3) - expect(res.body[0].id).toEqual(2) - expect(res.body[0].name).toEqual('CALCULO COMPUTACIONAL I') - expect(res.body[1].id).toEqual(3) - expect(res.body[1].name).toEqual('FISICA PARA COMPUTACAO') - expect(res.body[2].id).toEqual(4) - expect(res.body[2].name).toEqual('ALGORITMOS') + expect(res.body[0].studentId).toEqual(1) + expect(res.body[0].subjectId).toEqual(2) + expect(res.body[1].studentId).toEqual(1) + expect(res.body[1].subjectId).toEqual(3) + expect(res.body[2].studentId).toEqual(1) + expect(res.body[2].subjectId).toEqual(4) done() }) }) From de2adf00b944904d0fdfda5c567fb9b6ab374b71 Mon Sep 17 00:00:00 2001 From: Lakshamana Date: Fri, 14 Jun 2019 19:18:16 -0300 Subject: [PATCH 17/22] =?UTF-8?q?Ajusta=20endpoints=20para=20pend=C3=AAnci?= =?UTF-8?q?as=20de=20alunos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/studentComboBox.vue | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/components/studentComboBox.vue b/components/studentComboBox.vue index b8554f26..3b03c496 100644 --- a/components/studentComboBox.vue +++ b/components/studentComboBox.vue @@ -68,15 +68,15 @@ - + @@ -86,7 +86,7 @@ Confirmar
{ - this.studentPendencies = response.data + this.studentPendencies = response.data.map(pendency => pendency.id) }) .catch(e => this.openErrorNotification(e)) }, @@ -433,8 +433,8 @@ export default { } }) .then(response => { - this.totalPendenciesLength = response.headers['pagination-row-count'] - this.totalPendencies = response.data + this.totalSubjectsLength = response.headers['pagination-row-count'] + this.totalSubjects = response.data this.showPendencies = true }) .catch(e => { @@ -446,7 +446,7 @@ export default { if (this.canEdit) { this.$axios .post( - `/api/students/${this.student.id}/pendencies`, + `/api/students/${this.student.id}/pendencies/batch`, this.studentPendencies ) .then(response => { From 11261f4dde7a980f8db958f8b38d771cd3a27340 Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Fri, 14 Jun 2019 23:41:52 -0300 Subject: [PATCH 18/22] Adiciona flag pata obter todas as disciplinas --- server/controllers/subjects/List.js | 6 +++++- test/server/controllers/subjects.spec.js | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/server/controllers/subjects/List.js b/server/controllers/subjects/List.js index 2bd2b185..9f796f95 100644 --- a/server/controllers/subjects/List.js +++ b/server/controllers/subjects/List.js @@ -2,6 +2,10 @@ const Subject = require('../../models/Subject') const utils = require('../../utils') module.exports = async function listSubjects(ctx) { - const { page = 1 } = ctx.request.query + const { page = 1, paginate } = ctx.request.query + if (paginate !== undefined && paginate === '0') { + ctx.body = await Subject.fetchAll() + return + } utils.paginateContext(ctx, await Subject.fetchPage({ page })) } diff --git a/test/server/controllers/subjects.spec.js b/test/server/controllers/subjects.spec.js index a43a8439..2426d164 100644 --- a/test/server/controllers/subjects.spec.js +++ b/test/server/controllers/subjects.spec.js @@ -121,4 +121,21 @@ describe('/api/subjects', () => { expect(res.status).toEqual(422) done() }) + + test('GET /subjects?paginate=0 ALL SUBJECTS', async done => { + const { token } = await testUtils.user('admin') + const res = await chai + .request(server.listen()) + .get('/api/subjects?paginate=0') + .set('Authorization', `Bearer ${token}`) + expect(res.body).toBeDefined() + expect(res.type).toEqual('application/json') + expect(res.status).toEqual(200) + expect(res.body.length).toEqual(96) + expect(res.body[0].name).toEqual('ALGEBRA LINEAR PARA COMPUTACAO') + expect(res.body[95].name).toEqual( + '(ELETIVA) DISCIPLINA ELETIVA - SISTEMAS DE INFORMACAO' + ) + done() + }) }) From 3fbfa5ac37786e6633f62a5682102eabcbf5ae14 Mon Sep 17 00:00:00 2001 From: Lucas Souza Date: Fri, 14 Jun 2019 23:53:14 -0300 Subject: [PATCH 19/22] A pedidos do chefe do backend --- server/controllers/pendencies/{Update.js => FromBatch.js} | 2 +- server/controllers/pendencies/index.js | 4 ++-- server/router.js | 6 +++++- test/server/controllers/pendencies.spec.js | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) rename server/controllers/pendencies/{Update.js => FromBatch.js} (95%) diff --git a/server/controllers/pendencies/Update.js b/server/controllers/pendencies/FromBatch.js similarity index 95% rename from server/controllers/pendencies/Update.js rename to server/controllers/pendencies/FromBatch.js index 29530114..20184a40 100644 --- a/server/controllers/pendencies/Update.js +++ b/server/controllers/pendencies/FromBatch.js @@ -3,7 +3,7 @@ const Students = require('../../models/Student') const Pendencies = require('../../models/Pendency') const { knex } = require('../../db') -module.exports = async function updatePendencies(ctx) { +module.exports = async function pendenciesFromBatch(ctx) { const { studentId } = ctx.params const subjectsIdsReceived = ctx.request.body diff --git a/server/controllers/pendencies/index.js b/server/controllers/pendencies/index.js index 2574c54f..21b99a3c 100644 --- a/server/controllers/pendencies/index.js +++ b/server/controllers/pendencies/index.js @@ -1,5 +1,5 @@ const Show = require('./Show') const List = require('./List') -const Update = require('./Update') +const FromBatch = require('./FromBatch') -module.exports = { Show, List, Update } +module.exports = { Show, List, FromBatch } diff --git a/server/router.js b/server/router.js index 522d8536..a3ce3f37 100644 --- a/server/router.js +++ b/server/router.js @@ -51,7 +51,11 @@ api.post('/students/from-csv', bodyMultipart, students.FromCsv) // Pendencies Routes api.get('/students/:studentId/pendencies/:id', pendencies.Show) api.get('/students/:studentId/pendencies/', pendencies.List) -api.post('/students/:studentId/pendencies/batch', bodyJson, pendencies.Update) +api.post( + '/students/:studentId/pendencies/batch', + bodyJson, + pendencies.FromBatch +) // Subjects Routes api.get('/subjects/', subjects.List) diff --git a/test/server/controllers/pendencies.spec.js b/test/server/controllers/pendencies.spec.js index 0489e10f..2f2a55ac 100644 --- a/test/server/controllers/pendencies.spec.js +++ b/test/server/controllers/pendencies.spec.js @@ -91,7 +91,7 @@ describe('/api/students/:id/pendencies/', () => { done() }) - test('POST /students/1/pendencies/batch UPDATE PENDENCIES', async done => { + test('POST /students/1/pendencies/batch PENDENCIES FROM BATCH', async done => { const { token } = await testUtils.user('admin') const res = await chai .request(server.listen()) From 442e01b9c99321cc1119a54646e6e5bbcb3885ec Mon Sep 17 00:00:00 2001 From: Lakshamana Date: Sat, 15 Jun 2019 00:56:04 -0300 Subject: [PATCH 20/22] =?UTF-8?q?Troca=20pagina=C3=A7=C3=A3o=20por=20scrol?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/studentComboBox.vue | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/components/studentComboBox.vue b/components/studentComboBox.vue index 3b03c496..210775fa 100644 --- a/components/studentComboBox.vue +++ b/components/studentComboBox.vue @@ -66,7 +66,7 @@
{{ pendency.name }}{{ subject.name }}
- +
- Confirmar -
- +
@@ -292,9 +284,7 @@ export default { studentPendencies: [], studentData: Object.assign({}, this.student), isLoading: false, - defenseDate: new Date(), - currentPendenciesPage: 1, - totalSubjectsLength: 0 + defenseDate: new Date() } }, computed: { @@ -429,7 +419,7 @@ export default { this.$axios .get(`/api/subjects`, { params: { - page: this.currentPendenciesPage + paginate: 0 } }) .then(response => { @@ -459,10 +449,6 @@ export default { } this.showPendencies = false }, - onPageChange(page) { - this.currentPendenciesPage = page - this.getPendencies() - }, mapDocuments(documents) { documents.forEach(element => { if (element.type === 1) { @@ -570,4 +556,9 @@ export default { .scrollable { overflow-y: scroll; } + +.bottom-sticky { + bottom: 0; + position: sticky; +} From 412b3ec9a675c95a006a363e6264ec42bab92aec Mon Sep 17 00:00:00 2001 From: Lakshamana Date: Mon, 17 Jun 2019 17:36:49 -0300 Subject: [PATCH 21/22] =?UTF-8?q?Corre=C3=A7=C3=A3o=20na=20a=C3=A7=C3=A3o?= =?UTF-8?q?=20de=20recupera=C3=A7=C3=A3o=20de=20pend=C3=AAncias=20de=20est?= =?UTF-8?q?udantes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/studentComboBox.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/studentComboBox.vue b/components/studentComboBox.vue index 210775fa..7ea1e31b 100644 --- a/components/studentComboBox.vue +++ b/components/studentComboBox.vue @@ -75,7 +75,7 @@ {{ subject.name }} @@ -281,7 +281,7 @@ export default { uploadFile: File, crg: '', totalSubjects: [], - studentPendencies: [], + studentSubjects: [], studentData: Object.assign({}, this.student), isLoading: false, defenseDate: new Date() @@ -356,7 +356,9 @@ export default { this.$axios .get(`/api/students/${this.student.id}/pendencies`) .then(response => { - this.studentPendencies = response.data.map(pendency => pendency.id) + this.studentSubjects = response.data.map( + pendency => pendency.subjectId + ) }) .catch(e => this.openErrorNotification(e)) }, @@ -437,7 +439,7 @@ export default { this.$axios .post( `/api/students/${this.student.id}/pendencies/batch`, - this.studentPendencies + this.studentSubjects ) .then(response => { this.$toast.open({ From 6f899bba7a0cd6b4566d267e6810e45a9fda0da8 Mon Sep 17 00:00:00 2001 From: Lakshamana Date: Mon, 17 Jun 2019 23:13:39 -0300 Subject: [PATCH 22/22] Resolve problema de build quebrada --- components/studentComboBox.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/studentComboBox.vue b/components/studentComboBox.vue index 7ea1e31b..32de290d 100644 --- a/components/studentComboBox.vue +++ b/components/studentComboBox.vue @@ -356,9 +356,7 @@ export default { this.$axios .get(`/api/students/${this.student.id}/pendencies`) .then(response => { - this.studentSubjects = response.data.map( - pendency => pendency.subjectId - ) + this.studentSubjects = response.data.map(pendency => pendency.subjectId) }) .catch(e => this.openErrorNotification(e)) },