clean code refactor
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-06-18 15:26:15 +02:00
parent 3c2a392cb8
commit e6a72d0f09
2 changed files with 10 additions and 9 deletions

View File

@ -35,11 +35,11 @@ module.exports = Self => {
let worker = await models.Worker.findOne({where: {userFk: userId}});
let promises = [];
for (let i = 0; i < ticketIds.length; i++) {
for (let id of ticketIds) {
let promise = models.TicketTracking.changeState(ctx, {
stateFk: state.id,
workerFk: worker.id,
ticketFk: ticketIds[i]
ticketFk: id
});
promises.push(promise);
}

View File

@ -4,6 +4,10 @@ import UserError from 'core/lib/user-error';
import './style.scss';
export default class Controller extends Section {
constructor($element, $, vnReport) {
super($element, $);
this.vnReport = vnReport;
}
setDelivered() {
const checkedTickets = this.checked;
let ids = [];
@ -25,13 +29,9 @@ export default class Controller extends Section {
openDeliveryNotes(ids) {
for (let id of ids) {
const params = {
authorization: this.vnToken.token,
ticketId: id
};
const serializedParams = this.$httpParamSerializer(params);
window.open(`api/report/delivery-note?${serializedParams}`); ``;
this.vnReport.show('delivery-note', {
ticketId: id,
});
}
}
@ -156,6 +156,7 @@ export default class Controller extends Section {
return [minHour, maxHour];
}
}
Controller.$inject = ['$element', '$scope', 'vnReport'];
ngModule.component('vnTicketIndex', {
template: require('./index.html'),