Merge branch 'dev' into 3308-supplier_basic-data
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
d8c3113adc
|
@ -42,27 +42,21 @@ module.exports = Self => {
|
||||||
|
|
||||||
const stmts = [];
|
const stmts = [];
|
||||||
|
|
||||||
const startedMinusOne = new Date(started);
|
|
||||||
startedMinusOne.setDate(started.getDate() - 1);
|
|
||||||
|
|
||||||
const endedPlusOne = new Date(ended);
|
|
||||||
endedPlusOne.setDate(ended.getDate() + 1);
|
|
||||||
|
|
||||||
stmts.push(`
|
stmts.push(`
|
||||||
DROP TEMPORARY TABLE IF EXISTS
|
DROP TEMPORARY TABLE IF EXISTS
|
||||||
tmp.timeControlCalculate,
|
tmp.timeControlCalculate,
|
||||||
tmp.timeBusinessCalculate
|
tmp.timeBusinessCalculate
|
||||||
`);
|
`);
|
||||||
|
|
||||||
stmts.push(new ParameterizedSQL('CALL vn.timeControl_calculateByUser(?, ?, ?)', [userId, startedMinusOne, endedPlusOne]));
|
stmts.push(new ParameterizedSQL('CALL vn.timeControl_calculateByUser(?, ?, ?)', [userId, started, ended]));
|
||||||
|
|
||||||
stmts.push(new ParameterizedSQL('CALL vn.timeBusiness_calculateByUser(?, ?, ?)', [userId, startedMinusOne, endedPlusOne]));
|
stmts.push(new ParameterizedSQL('CALL vn.timeBusiness_calculateByUser(?, ?, ?)', [userId, started, ended]));
|
||||||
|
|
||||||
const resultIndex = stmts.push(new ParameterizedSQL(`
|
const resultIndex = stmts.push(new ParameterizedSQL(`
|
||||||
SELECT tbc.dated, tbc.timeWorkSeconds expectedHours, tcc.timeWorkSeconds workedHours
|
SELECT tcc.dated, tbc.timeWorkSeconds expectedHours, tcc.timeWorkSeconds workedHours
|
||||||
FROM tmp.timeBusinessCalculate tbc
|
FROM tmp.timeControlCalculate tcc
|
||||||
LEFT JOIN tmp.timeControlCalculate tcc ON tcc.dated = tbc.dated
|
LEFT JOIN tmp.timeBusinessCalculate tbc ON tcc.dated = tbc.dated
|
||||||
WHERE tbc.dated BETWEEN ? AND ?
|
WHERE tcc.dated BETWEEN DATE(?) AND DATE(?)
|
||||||
`, [started, ended])) - 1;
|
`, [started, ended])) - 1;
|
||||||
|
|
||||||
stmts.push(`
|
stmts.push(`
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('Worker getWorkedHours()', () => {
|
describe('Worker getWorkedHours()', () => {
|
||||||
it(`should return the expected hours and the worked hours of a given date`, async() => {
|
it(`should return the expected hours and the worked hours of a given date`, async() => {
|
||||||
const workerID = 1106;
|
const workerID = 1106;
|
||||||
let started = new Date();
|
const started = new Date();
|
||||||
started.setHours(0, 0, 0, 0);
|
started.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
let ended = new Date();
|
const ended = new Date();
|
||||||
ended.setHours(0, 0, 0, 0);
|
ended.setHours(23, 59, 59, 999);
|
||||||
|
|
||||||
const [result] = await app.models.Worker.getWorkedHours(workerID, started, ended);
|
const [result] = await models.Worker.getWorkedHours(workerID, started, ended);
|
||||||
|
|
||||||
expect(result.expectedHours).toEqual(28800); // 8:00 hours seconds
|
expect(result.expectedHours).toEqual(28800); // 8:00 hours in seconds
|
||||||
expect(result.workedHours).toEqual(29400); // 8:10 hours in seconds
|
expect(result.workedHours).toEqual(29400); // 8:10 hours in seconds
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -171,7 +171,6 @@ class Controller extends Section {
|
||||||
from: from,
|
from: from,
|
||||||
to: to
|
to: to
|
||||||
};
|
};
|
||||||
|
|
||||||
const query = `Workers/${this.$params.id}/getWorkedHours`;
|
const query = `Workers/${this.$params.id}/getWorkedHours`;
|
||||||
return this.$http.get(query, {params}).then(res => {
|
return this.$http.get(query, {params}).then(res => {
|
||||||
const workDays = res.data;
|
const workDays = res.data;
|
||||||
|
@ -212,7 +211,8 @@ class Controller extends Section {
|
||||||
let todayInWeek = this.weekDays.find(day => day.dated.getTime() === today.getTime());
|
let todayInWeek = this.weekDays.find(day => day.dated.getTime() === today.getTime());
|
||||||
|
|
||||||
if (todayInWeek && todayInWeek.hours && todayInWeek.hours.length) {
|
if (todayInWeek && todayInWeek.hours && todayInWeek.hours.length) {
|
||||||
const remainingTime = todayInWeek.workedHours ? ((todayInWeek.expectedHours - todayInWeek.workedHours) * 1000) : null;
|
const remainingTime = todayInWeek.workedHours ?
|
||||||
|
((todayInWeek.expectedHours - todayInWeek.workedHours) * 1000) : null;
|
||||||
const lastKnownEntry = todayInWeek.hours[todayInWeek.hours.length - 1];
|
const lastKnownEntry = todayInWeek.hours[todayInWeek.hours.length - 1];
|
||||||
const lastKnownTime = new Date(lastKnownEntry.timed).getTime();
|
const lastKnownTime = new Date(lastKnownEntry.timed).getTime();
|
||||||
const finishTimeStamp = lastKnownTime && remainingTime ? lastKnownTime + remainingTime : null;
|
const finishTimeStamp = lastKnownTime && remainingTime ? lastKnownTime + remainingTime : null;
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethod('getEventsFiltered', {
|
||||||
|
description: 'Get events filtered for zone and date',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'zoneFk',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The zone id',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'started',
|
||||||
|
type: 'date',
|
||||||
|
description: 'The date calendar start',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'ended',
|
||||||
|
type: 'date',
|
||||||
|
description: 'The date calendar end',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
returns: {
|
||||||
|
type: 'object',
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/getEventsFiltered`,
|
||||||
|
verb: 'GET'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.getEventsFiltered = async(zoneFk, started, ended, options) => {
|
||||||
|
const myOptions = {};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
query = `
|
||||||
|
SELECT *
|
||||||
|
FROM vn.zoneEvent
|
||||||
|
WHERE zoneFk = ?
|
||||||
|
AND ((type = 'indefinitely')
|
||||||
|
OR (type = 'day' AND dated BETWEEN ? AND ?)
|
||||||
|
OR (type = 'range'
|
||||||
|
AND (
|
||||||
|
(started BETWEEN ? AND ?)
|
||||||
|
OR (ended BETWEEN ? AND ?)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
ORDER BY type='indefinitely' DESC, type='range' DESC, type='day' DESC;`;
|
||||||
|
const events = await Self.rawSql(query, [zoneFk, started, ended, started, ended, started, ended], myOptions);
|
||||||
|
|
||||||
|
query = `
|
||||||
|
SELECT *
|
||||||
|
FROM vn.zoneExclusion
|
||||||
|
WHERE zoneFk = ?
|
||||||
|
AND dated BETWEEN ? AND ?;`;
|
||||||
|
const exclusions = await Self.rawSql(query, [zoneFk, started, ended], myOptions);
|
||||||
|
|
||||||
|
return {events, exclusions};
|
||||||
|
};
|
||||||
|
};
|
|
@ -1,12 +1,12 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('agency clone()', () => {
|
describe('agency clone()', () => {
|
||||||
it('should clone a zone', async() => {
|
it('should clone a zone', async() => {
|
||||||
const tx = await app.models.Zone.beginTransaction({});
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const newZone = await app.models.Zone.clone(1, options);
|
const newZone = await models.Zone.clone(1, options);
|
||||||
|
|
||||||
expect(newZone.name).toEqual('Zone pickup A');
|
expect(newZone.name).toEqual('Zone pickup A');
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const models = require('vn-loopback/server/server').models;
|
||||||
const LoopBackContext = require('loopback-context');
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('zone deletezone()', () => {
|
describe('zone deletezone()', () => {
|
||||||
|
@ -16,13 +16,13 @@ describe('zone deletezone()', () => {
|
||||||
active: activeCtx
|
active: activeCtx
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
const originalTickets = await app.models.Ticket.find({
|
const originalTickets = await models.Ticket.find({
|
||||||
where: {
|
where: {
|
||||||
zoneFk: zoneId
|
zoneFk: zoneId
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ticketIDs = originalTickets.map(ticket => ticket.id);
|
ticketIDs = originalTickets.map(ticket => ticket.id);
|
||||||
originalTicketStates = await app.models.TicketState.find({where: {
|
originalTicketStates = await models.TicketState.find({where: {
|
||||||
ticketFk: {inq: ticketIDs},
|
ticketFk: {inq: ticketIDs},
|
||||||
code: 'FIXING'}});
|
code: 'FIXING'}});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -31,16 +31,16 @@ describe('zone deletezone()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should delete a zone and update their tickets', async() => {
|
it('should delete a zone and update their tickets', async() => {
|
||||||
const tx = await app.models.Zone.beginTransaction({});
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
await app.models.Zone.deleteZone(ctx, zoneId, options);
|
await models.Zone.deleteZone(ctx, zoneId, options);
|
||||||
|
|
||||||
const updatedZone = await app.models.Zone.findById(zoneId, null, options);
|
const updatedZone = await models.Zone.findById(zoneId, null, options);
|
||||||
const anUpdatedTicket = await app.models.Ticket.findById(ticketIDs[0], null, options);
|
const anUpdatedTicket = await models.Ticket.findById(ticketIDs[0], null, options);
|
||||||
|
|
||||||
const updatedTicketStates = await app.models.TicketState.find({
|
const updatedTicketStates = await models.TicketState.find({
|
||||||
where: {
|
where: {
|
||||||
ticketFk: {inq: ticketIDs},
|
ticketFk: {inq: ticketIDs},
|
||||||
code: 'FIXING'
|
code: 'FIXING'
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('zone getEvents()', () => {
|
describe('zone getEvents()', () => {
|
||||||
it('should return all events for the specified geo and agency mode', async() => {
|
it('should return all events for the specified geo and agency mode', async() => {
|
||||||
const tx = await app.models.Zone.beginTransaction({});
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
let result = await app.models.Zone.getEvents(20, 1, options);
|
let result = await models.Zone.getEvents(20, 1, options);
|
||||||
|
|
||||||
expect(result.events.length).toEqual(10);
|
expect(result.events.length).toEqual(10);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
describe('zone getEventsFiltered()', () => {
|
||||||
|
it('should return events and exclusions for the specified zoneFk in a range of dates', async() => {
|
||||||
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
let result = await models.Zone.getEventsFiltered(10, '2021-10-01', '2021-10-02', options);
|
||||||
|
|
||||||
|
expect(result.events.length).toEqual(1);
|
||||||
|
expect(result.exclusions.length).toEqual(0);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,13 +1,13 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('zone getLeaves()', () => {
|
describe('zone getLeaves()', () => {
|
||||||
it('should return the country and the childs containing the search value', async() => {
|
it('should return the country and the childs containing the search value', async() => {
|
||||||
const tx = await app.models.Zone.beginTransaction({});
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
let result = await app.models.Zone.getLeaves(1, null, '46000', options);
|
let result = await models.Zone.getLeaves(1, null, '46000', options);
|
||||||
|
|
||||||
expect(result.length).toEqual(1);
|
expect(result.length).toEqual(1);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('zone includingExpired()', () => {
|
describe('zone includingExpired()', () => {
|
||||||
const inhousePickupId = 1;
|
const inhousePickupId = 1;
|
||||||
|
@ -6,14 +6,14 @@ describe('zone includingExpired()', () => {
|
||||||
const warehouseId = 1;
|
const warehouseId = 1;
|
||||||
|
|
||||||
it('should return an array containing all zones', async() => {
|
it('should return an array containing all zones', async() => {
|
||||||
const tx = await app.models.Zone.beginTransaction({});
|
const tx = await models.Zone.beginTransaction({});
|
||||||
const ctx = {req: {accessToken: {userId: 1}}};
|
const ctx = {req: {accessToken: {userId: 1}}};
|
||||||
const where = {};
|
const where = {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const result = await app.models.Zone.includingExpired(ctx, {where}, options);
|
const result = await models.Zone.includingExpired(ctx, {where}, options);
|
||||||
|
|
||||||
expect(result.length).toBeGreaterThan(2);
|
expect(result.length).toBeGreaterThan(2);
|
||||||
|
|
||||||
|
@ -28,12 +28,12 @@ describe('zone includingExpired()', () => {
|
||||||
const ctx = {req: {accessToken: {userId: 1}}};
|
const ctx = {req: {accessToken: {userId: 1}}};
|
||||||
const where = {agencyModeFk: inhousePickupId};
|
const where = {agencyModeFk: inhousePickupId};
|
||||||
|
|
||||||
const tx = await app.models.Zone.beginTransaction({});
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const result = await app.models.Zone.includingExpired(ctx, {where}, options);
|
const result = await models.Zone.includingExpired(ctx, {where}, options);
|
||||||
|
|
||||||
const validAgency = result.every(zone => zone.agencyModeFk = inhousePickupId);
|
const validAgency = result.every(zone => zone.agencyModeFk = inhousePickupId);
|
||||||
|
|
||||||
|
@ -56,12 +56,12 @@ describe('zone includingExpired()', () => {
|
||||||
warehouseFk: warehouseId
|
warehouseFk: warehouseId
|
||||||
};
|
};
|
||||||
|
|
||||||
const tx = await app.models.Zone.beginTransaction({});
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const result = await app.models.Zone.includingExpired(ctx, {where}, options);
|
const result = await models.Zone.includingExpired(ctx, {where}, options);
|
||||||
const firstZone = result[0];
|
const firstZone = result[0];
|
||||||
|
|
||||||
expect(firstZone.name).toEqual('Zone pickup A');
|
expect(firstZone.name).toEqual('Zone pickup A');
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('zone toggleIsIncluded()', () => {
|
describe('zone toggleIsIncluded()', () => {
|
||||||
it('should return the created location with isIncluded true', async() => {
|
it('should return the created location with isIncluded true', async() => {
|
||||||
const tx = await app.models.Zone.beginTransaction({});
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
let result = await app.models.Zone.toggleIsIncluded(1, 20, true, options);
|
let result = await models.Zone.toggleIsIncluded(1, 20, true, options);
|
||||||
|
|
||||||
expect(result.isIncluded).toBeTrue();
|
expect(result.isIncluded).toBeTrue();
|
||||||
|
|
||||||
|
@ -19,12 +19,12 @@ describe('zone toggleIsIncluded()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the created location with isIncluded false', async() => {
|
it('should return the created location with isIncluded false', async() => {
|
||||||
const tx = await app.models.Zone.beginTransaction({});
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
let result = await app.models.Zone.toggleIsIncluded(1, 20, false, options);
|
let result = await models.Zone.toggleIsIncluded(1, 20, false, options);
|
||||||
|
|
||||||
expect(result.isIncluded).toBeFalse();
|
expect(result.isIncluded).toBeFalse();
|
||||||
|
|
||||||
|
@ -36,14 +36,14 @@ describe('zone toggleIsIncluded()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the amount of deleted locations', async() => {
|
it('should return the amount of deleted locations', async() => {
|
||||||
const tx = await app.models.Zone.beginTransaction({});
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
await app.models.Zone.toggleIsIncluded(1, 20, false, options);
|
await models.Zone.toggleIsIncluded(1, 20, false, options);
|
||||||
|
|
||||||
let result = await app.models.Zone.toggleIsIncluded(1, 20, undefined, options);
|
let result = await models.Zone.toggleIsIncluded(1, 20, undefined, options);
|
||||||
|
|
||||||
expect(result).toEqual({count: 1});
|
expect(result).toEqual({count: 1});
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ module.exports = Self => {
|
||||||
require('../methods/zone/clone')(Self);
|
require('../methods/zone/clone')(Self);
|
||||||
require('../methods/zone/getLeaves')(Self);
|
require('../methods/zone/getLeaves')(Self);
|
||||||
require('../methods/zone/getEvents')(Self);
|
require('../methods/zone/getEvents')(Self);
|
||||||
|
require('../methods/zone/getEventsFiltered')(Self);
|
||||||
require('../methods/zone/toggleIsIncluded')(Self);
|
require('../methods/zone/toggleIsIncluded')(Self);
|
||||||
require('../methods/zone/getUpcomingDeliveries')(Self);
|
require('../methods/zone/getUpcomingDeliveries')(Self);
|
||||||
require('../methods/zone/deleteZone')(Self);
|
require('../methods/zone/deleteZone')(Self);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<vn-zone-calendar
|
<vn-zone-calendar
|
||||||
id="calendar"
|
id="calendar"
|
||||||
|
vn-id="calendar"
|
||||||
data="data"
|
data="data"
|
||||||
on-selection="$ctrl.onSelection($days, $type, $weekday, $events, $exclusions)"
|
on-selection="$ctrl.onSelection($days, $type, $weekday, $events, $exclusions)"
|
||||||
class="vn-w-md">
|
class="vn-w-md">
|
||||||
|
|
|
@ -21,15 +21,19 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
let data = {};
|
this.$.data = null;
|
||||||
this.$q.all([
|
this.$.$applyAsync(() => {
|
||||||
this.$http.get(this.path)
|
const params = {
|
||||||
.then(res => data.events = res.data),
|
zoneFk: this.$params.id,
|
||||||
this.$http.get(this.exclusionsPath)
|
started: this.$.calendar.firstDay,
|
||||||
.then(res => data.exclusions = res.data)
|
ended: this.$.calendar.lastDay
|
||||||
]).finally(() => {
|
};
|
||||||
|
|
||||||
|
this.$http.get(`Zones/getEventsFiltered`, {params}).then(res => {
|
||||||
|
const data = res.data;
|
||||||
this.$.data = data;
|
this.$.data = data;
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
formatWdays(weekDays) {
|
formatWdays(weekDays) {
|
||||||
|
|
|
@ -17,8 +17,26 @@ describe('component vnZoneEvents', () => {
|
||||||
|
|
||||||
describe('refresh()', () => {
|
describe('refresh()', () => {
|
||||||
it('should set the zone and then call both getSummary() and getWarehouses()', () => {
|
it('should set the zone and then call both getSummary() and getWarehouses()', () => {
|
||||||
$httpBackend.expectGET(`Zones/1/events`).respond({id: 1});
|
const date = '2021-10-01';
|
||||||
$httpBackend.expectGET(`Zones/1/exclusions`).respond({id: 1});
|
|
||||||
|
controller.$params.id = 999;
|
||||||
|
controller.$.calendar = {
|
||||||
|
firstDay: date,
|
||||||
|
lastDay: date
|
||||||
|
};
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
zoneFk: controller.$params.id,
|
||||||
|
started: date,
|
||||||
|
ended: date
|
||||||
|
};
|
||||||
|
|
||||||
|
const query = `Zones/getEventsFiltered?ended=${date}&started=${date}&zoneFk=${params.zoneFk}`;
|
||||||
|
const response = {
|
||||||
|
events: 'myEvents',
|
||||||
|
exclusions: 'myExclusions'
|
||||||
|
};
|
||||||
|
$httpBackend.whenGET(query).respond(response);
|
||||||
controller.refresh();
|
controller.refresh();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue