cr juan
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Javi Gallego 2020-05-19 08:46:42 +02:00
parent 3815edfbea
commit a7e6e3d4b7
14 changed files with 61 additions and 32 deletions

View File

@ -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;

View File

@ -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 ;

View File

@ -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

View File

@ -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');

View File

@ -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 = {};

View File

@ -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, {

View File

@ -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) {

View File

@ -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);
});

View File

@ -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');

View File

@ -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"

View File

@ -7,8 +7,7 @@
<vn-card>
<section ng-repeat="detail in details" class="vn-pa-md">
<vn-horizontal class="header">
<h5><span translate>{{detail.shipped}}</span></h5>
<h5>{{$ctrl.getWeekDay(detail.shipped)}} - {{detail.shipped | date: 'dd/MM/yyyy'}}</h5>
</vn-horizontal>
<vn-table>
<vn-thead>

View File

@ -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
});

View File

@ -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(`<vn-upcoming-deliveries></vn-upcoming-deliveries>`);
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');
});
});
});

View File

@ -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;