linter errors

This commit is contained in:
Carlos Jimenez 2018-11-06 13:59:16 +01:00
parent d85a4da1ab
commit 1ad44f22b4
6 changed files with 29 additions and 25 deletions

View File

@ -155,6 +155,7 @@ export default class Watcher extends Component {
});
}
return this.$q((resolve, reject) => {
this.$http.post(this.url, changedData).then(
json => this.writeData(json, resolve),
@ -203,9 +204,8 @@ export default class Watcher extends Component {
if (this.data)
Object.assign(this.data, this.orgData);
this.$state.go(this.state);
} else {
} else
this.state = null;
}
}
writeData(json, resolve) {
@ -236,6 +236,7 @@ export default class Watcher extends Component {
}
);
}
return newCopy;
}
}

View File

@ -12,8 +12,8 @@ class Controller {
this.deletable = false;
this.edit = {};
this.moreOptions = [
{callback: this.showAddTurnDialog, name: "Add turn", always: true},
{callback: this.showDeleteTicketDialog, name: "Delete ticket", always: true},
{callback: this.showAddTurnDialog, name: 'Add turn', always: true},
{callback: this.showDeleteTicketDialog, name: 'Delete ticket', always: true},
{callback: this.markAsReserved, name: 'Mark as reserved'},
{callback: this.unmarkAsReserved, name: 'Unmark as reserved'},
{callback: this.showEditDialog, name: 'Update discount'},
@ -77,9 +77,10 @@ class Controller {
}
get isChecked() {
if (this.sales)
if (this.sales) {
for (let instance of this.sales)
if (instance.checked) return true;
}
return false;
}
@ -87,16 +88,18 @@ class Controller {
getCheckedLines() {
let lines = [];
let data = this.sales;
if (data)
for (let i = 0; i < data.length; i++)
if (data) {
for (let i = 0; i < data.length; i++) {
if (data[i].checked)
lines.push({id: data[i].id, instance: i});
}
}
return lines;
}
// Change State
onStateOkClick() {
let filter = {where: {code: "OK"}, fields: ["id"]};
let filter = {where: {code: 'OK'}, fields: ['id']};
let json = encodeURIComponent(JSON.stringify(filter));
this.$http.get(`/ticket/api/States?filter=${json}`).then(res => {
this.onStateChange(res.data[0].id);
@ -197,7 +200,7 @@ class Controller {
let sales = this.getCheckedLines();
this.$http.post(`/api/Sales/MoveToNewTicket`, {ticket: ticket, sales: sales}).then(res => {
let url = this.$state.href("ticket.card.sale", {id: res.data.id}, {absolute: true});
let url = this.$state.href('ticket.card.sale', {id: res.data.id}, {absolute: true});
window.open(url, '_blank');
this.$scope.transfer.hide();
this.$scope.model.refresh();
@ -215,13 +218,12 @@ class Controller {
for (let i = 0; i < sales.length; i++)
sales[i].quantity = this.sales[sales[i].instance].quantity;
this.$http.post(`claim/api/Claims/createFromSales`, {claim: claim, sales: sales}).then(res => {
let url = this.$state.href("claim.card.basicData", {id: res.data.id}, {absolute: true});
window.open(url, '_blank');
this.$state.go('claim.card.basicData', {id: res.data.id});
});
}
goToTicket(ticketID) {
this.$state.go("ticket.card.sale", {id: ticketID});
this.$state.go('ticket.card.sale', {id: ticketID});
}
// Focus First Input
@ -288,6 +290,7 @@ class Controller {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
});
}
this.$scope.editPricePopover.hide();
}

View File

@ -1,7 +1,7 @@
const app = require(`${servicesDir}/ticket/server/server`);
describe('sale getClaimableFromTicket()', () => {
it('should throw an error if the ticket is not editable', async() => {
it('should return the claimable sales of a given ticket', async () => {
let claimableFromTicket = await app.models.Sale.getClaimableFromTicket(16);
expect(claimableFromTicket[0].concept).toBe('Gem of Time');

View File

@ -1,7 +1,7 @@
const app = require(`${servicesDir}/ticket/server/server`);
describe('sale moveToTicket()', () => {
it('should throw an error if the ticket is not editable', async() => {
it('should throw an error if the ticket is not editable', async () => {
let error;
let params = {actualTicketFk: 10};
@ -15,7 +15,7 @@ describe('sale moveToTicket()', () => {
expect(error).toBeDefined();
});
it('should throw an error if the receiving ticket is not editable', async() => {
it('should throw an error if the receiving ticket is not editable', async () => {
let error;
let params = {actualTicketFk: 1, newTicketFk: 10};
@ -29,7 +29,7 @@ describe('sale moveToTicket()', () => {
expect(error).toBeDefined();
});
it('should transfer the sales from one ticket to another', async() => {
it('should transfer the sales from one ticket to another', async () => {
let senderTicketSales = await app.models.Ticket.getSales(11);
let receiverTicketSales = await app.models.Ticket.getSales(13);
@ -53,7 +53,7 @@ describe('sale moveToTicket()', () => {
expect(receiverTicketSales.length).toEqual(2);
});
it('should transfers back the sales', async() => {
it('should transfers back the sales', async () => {
let senderTicketSales = await app.models.Ticket.getSales(13);
let receiverTicketSales = await app.models.Ticket.getSales(11);

View File

@ -3,17 +3,17 @@ const app = require(`${servicesDir}/ticket/server/server`);
describe('ticket changeState()', () => {
let ticket;
beforeAll(async() => {
beforeAll(async () => {
let originalTicket = await app.models.Ticket.findOne({where: {id: 16}});
originalTicket.id = null;
ticket = await app.models.Ticket.create(originalTicket);
});
afterAll(async() => {
afterAll(async () => {
await app.models.Ticket.destroyById(ticket.id);
});
it('should throw an error if the ticket is not editable and the user isnt production', async() => {
it('should throw an error if the ticket is not editable and the user isnt production', async () => {
let ctx = {req: {accessToken: {userId: 110}}};
let params = {ticketFk: 2, stateFk: 3};
let error;
@ -26,7 +26,7 @@ describe('ticket changeState()', () => {
expect(error).toEqual(new Error(`You don't have enough privileges to change the state of this ticket`));
});
it('should be able to create a ticket tracking line for a not editable ticket if the user has the production role', async() => {
it('should be able to create a ticket tracking line for a not editable ticket if the user has the production role', async () => {
let ctx = {req: {accessToken: {userId: 50}}};
let params = {ticketFk: 20, stateFk: 3};
@ -38,7 +38,7 @@ describe('ticket changeState()', () => {
expect(res.__data.id).toBeDefined();
});
it('return an array with the created ticket tracking line', async() => {
it('return an array with the created ticket tracking line', async () => {
let ctx = {req: {accessToken: {userId: 108}}};
let params = {ticketFk: ticket.id, stateFk: 3};
let res = await app.models.TicketTracking.changeState(ctx, params);

View File

@ -11,7 +11,7 @@ describe('ticket componentUpdate()', () => {
const today = new Date();
let ticketId = 11;
beforeAll(async() => {
beforeAll(async () => {
[componentValue] = await app.models.SaleComponent.rawSql(componentOfSaleSeven);
firstvalueBeforeChange = componentValue.value;
@ -19,7 +19,7 @@ describe('ticket componentUpdate()', () => {
secondvalueBeforeChange = componentValue.value;
});
it('should change the agencyMode to modify the sale components value', async() => {
it('should change the agencyMode to modify the sale components value', async () => {
let data = {
clientFk: 101,
agencyModeFk: 8,
@ -46,7 +46,7 @@ describe('ticket componentUpdate()', () => {
expect(secondvalueBeforeChange).not.toEqual(secondvalueAfterChange);
});
it('should change the agencyMode to go back to the originals sale components value', async() => {
it('should change the agencyMode to go back to the originals sale components value', async () => {
let data = {
clientFk: 101,
agencyModeFk: 7,