getVolume route should return only data #324 CR: Juan
This commit is contained in:
parent
8231a935d6
commit
74410d4045
|
@ -19,7 +19,7 @@ class Controller extends FilterTicketList {
|
|||
.then(response => {
|
||||
if (response.data) {
|
||||
this.$scope.index.model.instances.forEach(sale => {
|
||||
response.data.volumes[0].forEach(volume => {
|
||||
response.data.volumes.forEach(volume => {
|
||||
if (sale.id === volume.saleFk) {
|
||||
sale.volume = volume;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.getVolume = async ticketFk => {
|
||||
return await Self.rawSql(`CALL vn.ticketListVolume(?);`, [ticketFk]);
|
||||
let [volume] = await Self.rawSql(`CALL vn.ticketListVolume(?)`, [ticketFk]);
|
||||
return volume;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@ describe('ticket getVolume()', () => {
|
|||
let ticketFk = 1;
|
||||
app.models.Ticket.getVolume(ticketFk)
|
||||
.then(response => {
|
||||
expect(response[0][0].m3_total).toEqual(0.008);
|
||||
expect(response[0].m3_total).toEqual(0.008);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue