diff --git a/db/changes/10180-holyWeek/00-time_createTable.sql b/db/changes/10180-holyWeek/00-time_createTable.sql index 980120002..62b60c4bf 100644 --- a/db/changes/10180-holyWeek/00-time_createTable.sql +++ b/db/changes/10180-holyWeek/00-time_createTable.sql @@ -7,11 +7,11 @@ CREATE DEFINER=`root`@`%` PROCEDURE `time_createTable`(vStarted DATE, vEnded DAT BEGIN DECLARE vCurrentDate DATE; - DROP TEMPORARY TABLE IF EXISTS tmp.tTime; - CREATE TEMPORARY TABLE tmp.tTime (dated DATE PRIMARY KEY); + DROP TEMPORARY TABLE IF EXISTS tmp.time; + CREATE TEMPORARY TABLE tmp.time (dated DATE PRIMARY KEY) ENGINE = MEMORY; SET vCurrentDate = vStarted; WHILE vCurrentDate <= vEnded DO - INSERT INTO tmp.tTime (dated) VALUES (vCurrentDate); + INSERT INTO tmp.time (dated) VALUES (vCurrentDate); SET vCurrentDate = DATE_ADD(vCurrentDate, INTERVAL 1 DAY); END WHILE; diff --git a/db/changes/10180-holyWeek/03-zone_UpcomingDeliveries.sql b/db/changes/10180-holyWeek/03-zone_UpcomingDeliveries.sql index 39c6e2166..c8f85527e 100644 --- a/db/changes/10180-holyWeek/03-zone_UpcomingDeliveries.sql +++ b/db/changes/10180-holyWeek/03-zone_UpcomingDeliveries.sql @@ -3,7 +3,7 @@ DROP procedure IF EXISTS `zone_upcomingDeliveries`; DELIMITER $$ USE `vn`$$ -CREATE PROCEDURE `zone_upcomingDeliveries` () +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_upcomingDeliveries`() BEGIN DECLARE vForwardDays INT; @@ -20,7 +20,7 @@ BEGIN ti.dated shipped FROM zone z JOIN zoneEvent e ON e.zoneFk = z.id - JOIN tmp.tTime ti ON ti.dated BETWEEN curdate() AND TIMESTAMPADD(DAY, vForwardDays, curdate()); + JOIN tmp.time ti ON ti.dated BETWEEN curdate() AND TIMESTAMPADD(DAY, vForwardDays, curdate()); DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; CREATE TEMPORARY TABLE tmp.zoneOption @@ -62,16 +62,18 @@ BEGIN JOIN zoneExclusion e ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed; - SELECT zo.*, zg.`name`, (ELT(WEEKDAY(zo.shipped) + 1, 'Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado', 'Domingo')) weekday + SELECT MAX(zo.`hour`) `hour`, zg.`name`, zo.shipped FROM tmp.zoneOption zo - JOIN zone z ON z.id = zo.zoneFk + JOIN `zone` z ON z.id = zo.zoneFk + JOIN agencyMode am ON am.id = z.agencyModeFk + JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk JOIN zoneIncluded zi ON zi.zoneFk = z.id - JOIN zoneGeo zg ON zg.id = zi.geoFk AND zg.depth = 1 - WHERE z.`name` like '%zon%' + JOIN zoneGeo zg ON zg.id = zi.geoFk AND zg.type = 'province' + WHERE dm.code = 'DELIVERY' GROUP BY shipped, zg.`name` ORDER BY shipped, zg.`name`; - DROP TEMPORARY TABLE tmp.tTime, tLandings; + DROP TEMPORARY TABLE tmp.time, tLandings; END$$ DELIMITER ; diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index c3c6581e1..c06bdbb85 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1710,13 +1710,11 @@ INSERT INTO `vn`.`zoneIncluded` (`zoneFk`, `geoFk`, `isIncluded`) (2, 1, 1), (3, 3, 0), (3, 4, 0), - (3, 5, 0), - (3, 10, 1), + (3, 5, 0), (3, 1, 1), (4, 3, 0), (4, 4, 0), - (4, 5, 0), - (4, 10, 1), + (4, 5, 0), (4, 1, 1), (5, 3, 1), (5, 4, 0), @@ -1733,7 +1731,8 @@ INSERT INTO `vn`.`zoneIncluded` (`zoneFk`, `geoFk`, `isIncluded`) (8, 3, 0), (8, 4, 0), (8, 5, 0), - (8, 1, 1); + (8, 1, 1), + (10, 10, 1); INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `dated`) VALUES @@ -1944,7 +1943,9 @@ INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `dated`) (7, 'day', DATE_ADD(CURDATE(), INTERVAL +6 DAY)); INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `weekDays`) - VALUES (8, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun'); + VALUES + (8, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun'), + (10, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun'); INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`) VALUES diff --git a/e2e/paths/02-client/04_edit_billing_data.spec.js b/e2e/paths/02-client/04_edit_billing_data.spec.js index 394324509..d520a7e30 100644 --- a/e2e/paths/02-client/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client/04_edit_billing_data.spec.js @@ -31,7 +31,7 @@ describe('Client Edit billing data path', () => { expect(message.text).toBe('That payment method requires an IBAN'); }); - // 2215: Windows (hidden mode): Entity code doesn't get the focus, '9999' is written in entity name. + // 2256: Windows (hidden mode): Entity code doesn't get the focus, '9999' is written in entity name. xit(`should create a new BIC code`, async() => { await page.waitToClick(selectors.clientBillingData.newBankEntityButton); await page.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank'); diff --git a/front/core/services/week-days.js b/front/core/services/week-days.js index cf5722520..409b69b5c 100644 --- a/front/core/services/week-days.js +++ b/front/core/services/week-days.js @@ -39,7 +39,7 @@ export default class WeekDays { new WeekDay('wed', 'Wednesday'), new WeekDay('thu', 'Thursday'), new WeekDay('fri', 'Friday'), - new WeekDay('sat', 'Friday') + new WeekDay('sat', 'Saturday') ]; this.map = {}; diff --git a/modules/ticket/back/methods/ticket/updateDiscount.js b/modules/ticket/back/methods/ticket/updateDiscount.js index 5ec887836..3b69c6b68 100644 --- a/modules/ticket/back/methods/ticket/updateDiscount.js +++ b/modules/ticket/back/methods/ticket/updateDiscount.js @@ -76,7 +76,7 @@ module.exports = Self => { }); const alertLevel = state ? state.alertLevel : null; - if (isLocked || (!isSalesPerson && alertLevel > 0 )) + if (isLocked || (!isSalesPerson && alertLevel > 0)) throw new UserError(`The sales of this ticket can't be modified`); const ticket = await models.Ticket.findById(id, { diff --git a/modules/zone/back/methods/zone/getUpcomingDeliveries.js b/modules/zone/back/methods/zone/getUpcomingDeliveries.js index c690cc3d8..a917d7200 100644 --- a/modules/zone/back/methods/zone/getUpcomingDeliveries.js +++ b/modules/zone/back/methods/zone/getUpcomingDeliveries.js @@ -22,7 +22,7 @@ module.exports = Self => { const shipped = zone.shipped; let zoneDetail = details.find(zone => { - return zone.shipped == shipped; + return zone.shipped.toString() == shipped.toString(); }); if (!zoneDetail) { diff --git a/modules/zone/back/methods/zone/specs/getUpcomingDeliveries.spec.js b/modules/zone/back/methods/zone/specs/getUpcomingDeliveries.spec.js index 95da4b4b1..263ea598f 100644 --- a/modules/zone/back/methods/zone/specs/getUpcomingDeliveries.spec.js +++ b/modules/zone/back/methods/zone/specs/getUpcomingDeliveries.spec.js @@ -3,13 +3,13 @@ const app = require('vn-loopback/server/server'); describe('zone getUpcomingDeliveries()', () => { it('should check returns data', async() => { let result = await app.models.Zone.getUpcomingDeliveries(); - console.log(result); + const firstResultLines = result[0].lines; const secondResultLines = result[1].lines; const thirdResultLines = result[2].lines; - expect(result.length).toEqual(7); - expect(firstResultLines.length).toEqual(2); + expect(result.length).toEqual(8); + expect(firstResultLines.length).toEqual(1); expect(secondResultLines.length).toEqual(1); expect(thirdResultLines.length).toEqual(1); }); diff --git a/modules/zone/front/delivery-days/index.spec.js b/modules/zone/front/delivery-days/index.spec.js index 8ad4af80e..156407420 100644 --- a/modules/zone/front/delivery-days/index.spec.js +++ b/modules/zone/front/delivery-days/index.spec.js @@ -61,7 +61,7 @@ describe('Zone Component vnZoneDeliveryDays', () => { expect(controller.$.data).toEqual(expectedData); }); }); - + // PeticiĆ³n #2259 cread xdescribe('onSelection()', () => { it('should not call the show popover method if events array is empty', () => { jest.spyOn(controller.$.zoneEvents, 'show'); diff --git a/modules/zone/front/routes.json b/modules/zone/front/routes.json index bd4826ecb..6c799dcc8 100644 --- a/modules/zone/front/routes.json +++ b/modules/zone/front/routes.json @@ -35,7 +35,7 @@ "component": "vn-zone-delivery-days", "description": "Delivery days" }, { - "url": "/upcoming-deliveries?q", + "url": "/upcoming-deliveries", "state": "zone.upcomingDeliveries", "component": "vn-upcoming-deliveries", "description": "Upcoming deliveries" diff --git a/modules/zone/front/upcoming-deliveries/index.html b/modules/zone/front/upcoming-deliveries/index.html index f7f0c4a4f..1089c9c89 100644 --- a/modules/zone/front/upcoming-deliveries/index.html +++ b/modules/zone/front/upcoming-deliveries/index.html @@ -7,8 +7,7 @@
-
{{detail.shipped}}
- +
{{$ctrl.getWeekDay(detail.shipped)}} - {{detail.shipped | date: 'dd/MM/yyyy'}}
diff --git a/modules/zone/front/upcoming-deliveries/index.js b/modules/zone/front/upcoming-deliveries/index.js index ac44e3786..e8e6909ae 100644 --- a/modules/zone/front/upcoming-deliveries/index.js +++ b/modules/zone/front/upcoming-deliveries/index.js @@ -5,8 +5,13 @@ import './style.scss'; class Controller extends Section { constructor($element, $, vnWeekDays) { super($element, $); - this.weekDays = []; - this.weekdayNames = vnWeekDays.locales; + this.days = vnWeekDays.days; + } + + getWeekDay(jsonDate) { + const weekDay = new Date(jsonDate).getDay(); + + return this.days[weekDay].locale; } } @@ -14,5 +19,5 @@ Controller.$inject = ['$element', '$scope', 'vnWeekDays']; ngModule.component('vnUpcomingDeliveries', { template: require('./index.html'), - controller: Section + controller: Controller }); diff --git a/modules/zone/front/upcoming-deliveries/index.spec.js b/modules/zone/front/upcoming-deliveries/index.spec.js new file mode 100644 index 000000000..9f5c322a4 --- /dev/null +++ b/modules/zone/front/upcoming-deliveries/index.spec.js @@ -0,0 +1,22 @@ +import './index'; + +describe('component vnUpcomingDeliveries', () => { + let $scope; + let controller; + + beforeEach(ngModule('zone')); + + beforeEach(angular.mock.inject(($componentController, $rootScope) => { + $scope = $rootScope.$new(); + const $element = angular.element(``); + controller = $componentController('vnUpcomingDeliveries', {$element, $scope}); + })); + + fdescribe('getWeekDay()', () => { + it('should retrieve a weekday for a json passed', () => { + let jsonDate = '1970-01-01T22:00:00.000Z'; + + expect(controller.getWeekDay(jsonDate)).toEqual('Thursday'); + }); + }); +}); diff --git a/modules/zone/front/upcoming-deliveries/style.scss b/modules/zone/front/upcoming-deliveries/style.scss index f416f99b4..d3f33260a 100644 --- a/modules/zone/front/upcoming-deliveries/style.scss +++ b/modules/zone/front/upcoming-deliveries/style.scss @@ -10,8 +10,8 @@ vn-upcoming-deliveries { padding-bottom: 7px; padding-bottom: 4px; font-weight: lighter; - background-color: #fde6ca; - border-bottom: 1px solid #f7931e; + background-color: $color-main-light; + border-bottom: 1px solid $color-primary; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;