Merge pull request '2293 - getVolume() call to saleVolume' (#309) from 2293-getVolume into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-by: Bernat Exposito <bernat@verdnatura.es>
This commit is contained in:
commit
70d5c641ad
|
@ -20,7 +20,7 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.getVolume = async ticketFk => {
|
||||
let [volume] = await Self.rawSql(`CALL vn.ticketListVolume(?)`, [ticketFk]);
|
||||
return volume;
|
||||
return Self.rawSql(`SELECT * FROM vn.saleVolume
|
||||
WHERE ticketFk = ?`, [ticketFk]);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@ describe('ticket getVolume()', () => {
|
|||
let ticketFk = 1;
|
||||
await app.models.Ticket.getVolume(ticketFk)
|
||||
.then(response => {
|
||||
expect(response[0].m3).toEqual(1.09);
|
||||
expect(response[0].volume).toEqual(1.09);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
sub-name="::sale.item.subName"/>
|
||||
</vn-td>
|
||||
<vn-td number>{{::sale.quantity}}</vn-td>
|
||||
<vn-td number>{{::sale.volume.m3 | number:3}}</vn-td>
|
||||
<vn-td number>{{::sale.saleVolume.volume | number:3}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
|
|
|
@ -39,7 +39,7 @@ class Controller extends Section {
|
|||
this.sales.forEach(sale => {
|
||||
this.volumes.forEach(volume => {
|
||||
if (sale.id === volume.saleFk)
|
||||
sale.volume = volume;
|
||||
sale.saleVolume = volume;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -59,10 +59,10 @@ describe('ticket', () => {
|
|||
|
||||
it(`should apply volumes to the sales if sales and volumes properties are defined on controller`, () => {
|
||||
controller.sales = [{id: 1, name: 'Sale one'}, {id: 2, name: 'Sale two'}];
|
||||
controller.volumes = [{saleFk: 1, m3: 0.012}, {saleFk: 2, m3: 0.015}];
|
||||
controller.volumes = [{saleFk: 1, volume: 0.012}, {saleFk: 2, volume: 0.015}];
|
||||
|
||||
expect(controller.sales[0].volume.m3).toEqual(0.012);
|
||||
expect(controller.sales[1].volume.m3).toEqual(0.015);
|
||||
expect(controller.sales[0].saleVolume.volume).toEqual(0.012);
|
||||
expect(controller.sales[1].saleVolume.volume).toEqual(0.015);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue