seat numbering algorithm working

This commit is contained in:
janishutz committed 2023-09-20 16:13:00 +02:00
1 parent 32baf07c39
commit 203af48961
6 files changed
+31 -22

No files matched your search

+1 -1
View File
@@ -1 +1 @@
{"test2":{"draft":{"seatInfo":{"data":{"1":{"0":22,"1":22,"2":22,"3":22,"4":22,"5":22,"6":22,"7":22,"8":22,"9":22,"10":22,"11":22,"12":22,"13":22,"14":22,"15":22}},"count":352},"data":{"1":{"x":296.892,"y":13.495,"h":560.66,"w":728.735,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1"},"2":{"x":357.007,"y":660.033,"h":117.775,"w":601.145,"active":false,"draggable":true,"resizable":true,"id":2,"origin":3,"shape":"rectangular","type":"stage","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"3":{"x":517.721,"y":669.847,"h":80.971,"w":304.253,"active":false,"draggable":true,"resizable":true,"id":3,"origin":1,"shape":"rectangular","type":"text","startingRow":1,"seatNumberingPosition":2,"sector":"A","text":{"text":"Stage","textSize":25,"colour":"#2160ff"},"ticketCount":1,"numberingDirection":"left","category":"1"}}},"save":{"seatInfo":{"data":{"1":{"0":22,"1":22,"2":22,"3":22,"4":22,"5":22,"6":22,"7":22,"8":22,"9":22,"10":22,"11":22,"12":22,"13":22,"14":22,"15":22}},"count":0},"data":{"1":{"x":296.892,"y":13.495,"h":560.66,"w":728.735,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1"},"2":{"x":357.375,"y":660.049,"h":117.775,"w":601.145,"active":false,"draggable":true,"resizable":true,"id":2,"origin":3,"shape":"rectangular","type":"stage","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"3":{"x":517.828,"y":670.99,"h":80.971,"w":304.253,"active":false,"draggable":true,"resizable":true,"id":3,"origin":1,"shape":"rectangular","type":"text","startingRow":1,"seatNumberingPosition":2,"sector":"A","text":{"text":"Stage","textSize":25,"colour":"#2160ff"},"ticketCount":1,"numberingDirection":"left","category":"1"}}}},"test":{"draft":{},"save":{"seatInfo":{"data":{"1":{"0":22}},"count":0},"data":{"1":{"x":427.696,"y":160.539,"h":371.324,"w":734.069,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"stand","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1","ticketCount":50}}}},"testLocationNoSeatplan":{"draft":{},"save":{"seatInfo":{"data":{"1":{"0":13,"1":13,"2":13,"3":13,"4":13,"startingRow":1}},"count":50},"data":{"1":{"x":370.138,"y":164.1,"h":288.088,"w":745.746,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"stand","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1","ticketCount":50}}}},"complexSeatplan":{"draft":{},"save":{"seatInfo":{"details":{"1":{"0":14,"1":14,"2":14,"3":14,"4":14,"5":14,"6":14,"7":14,"startingRow":1},"2":{"1":1,"2":3,"3":4,"4":6,"5":7,"6":9,"7":10,"8":12,"startingRow":1},"3":{"1":2,"2":4,"3":6,"4":8,"5":10,"6":12,"startingRow":1},"4":{"0":9,"1":9,"2":9,"startingRow":1}},"count":244,"data":{"A":{"1":{"1":2,"2":4,"3":6,"4":8,"5":10,"6":12,"startingRow":1},"2":{"0":14,"1":14,"2":14,"3":14,"4":14,"5":14,"6":14,"7":14,"startingRow":1},"3":{"1":1,"2":3,"3":4,"4":6,"5":7,"6":9,"7":10,"8":12,"startingRow":1},"4":{"0":9,"1":9,"2":9,"startingRow":1}}}},"data":{"1":{"x":576.031,"y":148.84,"h":284.149,"w":477.448,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":2,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1"},"2":{"x":1038.015,"y":162.371,"h":299.613,"w":591.495,"active":false,"draggable":true,"resizable":true,"id":2,"origin":1,"shape":"circular","type":"seat","startingRow":1,"seatNumberingPosition":3,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"3":{"x":262.887,"y":137.242,"h":324.742,"w":318.943,"active":false,"draggable":true,"resizable":true,"id":3,"origin":2,"shape":"trapezoid","type":"seat","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"4":{"x":715.206,"y":606.959,"h":121.778,"w":305.412,"active":false,"draggable":true,"resizable":true,"id":4,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":4,"sector":"A","text":{"text":"TestLine truncated
{"test2":{"draft":{"seatInfo":{"data":{"1":{"0":22,"1":22,"2":22,"3":22,"4":22,"5":22,"6":22,"7":22,"8":22,"9":22,"10":22,"11":22,"12":22,"13":22,"14":22,"15":22}},"count":352},"data":{"1":{"x":296.892,"y":13.495,"h":560.66,"w":728.735,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1"},"2":{"x":357.007,"y":660.033,"h":117.775,"w":601.145,"active":false,"draggable":true,"resizable":true,"id":2,"origin":3,"shape":"rectangular","type":"stage","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"3":{"x":517.721,"y":669.847,"h":80.971,"w":304.253,"active":false,"draggable":true,"resizable":true,"id":3,"origin":1,"shape":"rectangular","type":"text","startingRow":1,"seatNumberingPosition":2,"sector":"A","text":{"text":"Stage","textSize":25,"colour":"#2160ff"},"ticketCount":1,"numberingDirection":"left","category":"1"}}},"save":{"seatInfo":{"data":{"1":{"0":22,"1":22,"2":22,"3":22,"4":22,"5":22,"6":22,"7":22,"8":22,"9":22,"10":22,"11":22,"12":22,"13":22,"14":22,"15":22}},"count":0},"data":{"1":{"x":296.892,"y":13.495,"h":560.66,"w":728.735,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1"},"2":{"x":357.375,"y":660.049,"h":117.775,"w":601.145,"active":false,"draggable":true,"resizable":true,"id":2,"origin":3,"shape":"rectangular","type":"stage","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"3":{"x":517.828,"y":670.99,"h":80.971,"w":304.253,"active":false,"draggable":true,"resizable":true,"id":3,"origin":1,"shape":"rectangular","type":"text","startingRow":1,"seatNumberingPosition":2,"sector":"A","text":{"text":"Stage","textSize":25,"colour":"#2160ff"},"ticketCount":1,"numberingDirection":"left","category":"1"}}}},"test":{"draft":{},"save":{"seatInfo":{"data":{"1":{"0":22}},"count":0},"data":{"1":{"x":427.696,"y":160.539,"h":371.324,"w":734.069,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"stand","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1","ticketCount":50}}}},"testLocationNoSeatplan":{"draft":{},"save":{"seatInfo":{"data":{"1":{"0":13,"1":13,"2":13,"3":13,"4":13,"startingRow":1}},"count":50},"data":{"1":{"x":370.138,"y":164.1,"h":288.088,"w":745.746,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"stand","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1","ticketCount":50}}}},"complexSeatplan":{"draft":{},"save":{"seatInfo":{"details":{"1":{"0":14,"1":14,"2":14,"3":14,"4":14,"5":14,"6":14,"7":14,"startingRow":1},"2":{"0":2,"1":4,"2":5,"3":7,"4":8,"5":10,"6":11,"7":13,"startingRow":1},"3":{"0":2,"1":4,"2":6,"3":8,"4":10,"5":12,"startingRow":1},"4":{"0":9,"1":9,"2":9,"startingRow":1}},"count":244,"data":{"A":{"1":{"0":2,"1":4,"2":6,"3":8,"4":10,"5":12,"startingRow":1},"2":{"0":14,"1":14,"2":14,"3":14,"4":14,"5":14,"6":14,"7":14,"startingRow":1},"3":{"0":2,"1":4,"2":5,"3":7,"4":8,"5":10,"6":11,"7":13,"startingRow":1},"4":{"0":9,"1":9,"2":9,"startingRow":1}}}},"data":{"1":{"x":574.098,"y":146.907,"h":282.216,"w":475.515,"active":false,"draggable":true,"resizable":true,"id":1,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":2,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"numberingDirection":"left","category":"1"},"2":{"x":1037.99,"y":164.215,"h":297.68,"w":589.562,"active":false,"draggable":true,"resizable":true,"id":2,"origin":1,"shape":"circular","type":"seat","startingRow":1,"seatNumberingPosition":3,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"3":{"x":262.887,"y":137.24,"h":322.809,"w":317.01,"active":false,"draggable":true,"resizable":true,"id":3,"origin":2,"shape":"trapezoid","type":"seat","startingRow":1,"seatNumberingPosition":1,"sector":"A","text":{"text":"TestText","textSize":20,"colour":"#20FFFF"},"ticketCount":1,"numberingDirection":"left","category":"1"},"4":{"x":715.206,"y":606.961,"h":119.845,"w":303.479,"active":false,"draggable":true,"resizable":true,"id":4,"origin":1,"shape":"rectangular","type":"seat","startingRow":1,"seatNumberingPosition":4,"sector":"A","text":{"text":"TestTLine truncated
@@ -67,7 +67,7 @@ export default {
let details = { 'data': {}, 'id': this.id };
for ( let row = this.startingRow; row < count; row++ ) {
let nn = row * ( Math.PI / 2 );
details.data[ row ] = Math.floor( nn );
details.data[ row - 1 ] = Math.ceil( nn );
let r = row * size;
this.seats[ row ] = {};
for ( let n = 0; n < nn; n++ ) {
@@ -72,7 +72,7 @@ export default {
for ( let row = this.startingRow; row < count; row++ ) {
let nn = 2 + ( row - 1 ) * 2;
this.seats[ row ] = {};
details.data[ row ] = Math.floor( nn );
details.data[ row - 1 ] = Math.floor( nn );
for ( let n = 0; n < nn; n++ ) {
let side = n * sideOffset;
if ( this.origin === 1 ) {
@@ -73,10 +73,13 @@ export default {
console.log( this.data.seatInfo );
let offsets = {};
if ( this.data.seatInfo ) {
for ( let element in this.data.seatInfo.data ) {
if ( this.data.seatInfo.data[ element ] > this.data.seatNumbering ) {
for ( let row in this.data.seatInfo.data[ element ] ) {
offsets[ row ] += this.data.seatInfo.data[ element ][ row ];
for ( let element in this.data.seatInfo.data[ this.data.sector ] ) {
if ( element < this.data.seatNumbering ) {
for ( let row in this.data.seatInfo.data[ this.data.sector ][ element ] ) {
if ( row !== 'startingRow' ) {
if ( !offsets[ row ] ) offsets[ row ] = 0;
offsets[ row ] += this.data.seatInfo.data[ this.data.sector ][ element ][ row ];
}
}
}
}
@@ -90,8 +93,8 @@ export default {
let nn = row * ( Math.PI / 2 );
let r = row * size;
this.seats[ row ] = {};
for ( let n = ( offsets[ row ] ?? 0 ); n < ( nn + ( offsets[ row ] ?? 0 ) ); n++ ) {
const seatNumber = this.data.numberingDirection === 'right' ? ( Math.floor( w / size ) + ( offsets[ row ] ?? 0 ) ) - n: n;
for ( let n = 0; n < nn; n++ ) {
const seatNumber = this.data.numberingDirection === 'right' ? nn - n: n + ( offsets[ row - 1 ] ?? 0 );
this.seats[ row ][ n ] = {
'style': '',
'id': 'comp' + this.id + 'sec' + this.data.sector + 'r' + row + 's' + seatNumber,
@@ -75,11 +75,15 @@ export default {
// Size of seat at scale 1 is 32px
// w & h are normalised
let offsets = {};
console.log( this.data.seatInfo );
if ( this.data.seatInfo ) {
for ( let element in this.data.seatInfo.data ) {
if ( this.data.seatInfo.data[ element ] > this.data.seatNumbering ) {
for ( let row in this.data.seatInfo.data[ element ] ) {
offsets[ row ] += this.data.seatInfo.data[ element ][ row ];
for ( let element in this.data.seatInfo.data[ this.data.sector ] ) {
if ( element < this.data.seatNumbering ) {
for ( let row in this.data.seatInfo.data[ this.data.sector ][ element ] ) {
if ( row !== 'startingRow' ) {
if ( !offsets[ row ] ) offsets[ row ] = 0;
offsets[ row ] += this.data.seatInfo.data[ this.data.sector ][ element ][ row ];
}
}
}
}
@@ -90,8 +94,8 @@ export default {
this.seats = {};
for ( let row = 0; row < Math.floor( h / size ); row++ ) {
this.seats[ row ] = {};
for ( let n = ( offsets[ row ] ?? 0 ); n < ( Math.floor( w / size ) + ( offsets[ row ] ?? 0 ) ); n++ ) {
const seatNumber = this.data.numberingDirection === 'right' ? ( Math.floor( w / size ) + ( offsets[ row ] ?? 0 ) ) - n: n;
for ( let n = 0; n < Math.floor( w / size ); n++ ) {
const seatNumber = this.data.numberingDirection === 'right' ? Math.floor( w / size ) - n: n + ( offsets[ row ] ?? 0 );
this.seats[ row ][ n ] = {
'style': '',
'id': 'comp' + this.id + 'sec' + this.data.sector + 'r' + row + 's' + seatNumber,
@@ -70,13 +70,15 @@ export default {
calculateChairs () {
// Size of seat at scale 1 is 32px
// w & h are normalised
// TODO: update to new algorithm
let offsets = {};
if ( this.data.seatInfo ) {
for ( let element in this.data.seatInfo.data ) {
if ( this.data.seatInfo.data[ element ] > this.data.seatNumbering ) {
for ( let row in this.data.seatInfo.data[ element ] ) {
offsets[ row ] += this.data.seatInfo.data[ element ][ row ];
for ( let element in this.data.seatInfo.data[ this.data.sector ] ) {
if ( element < this.data.seatNumbering ) {
for ( let row in this.data.seatInfo.data[ this.data.sector ][ element ] ) {
if ( row !== 'startingRow' ) {
if ( !offsets[ row ] ) offsets[ row ] = 0;
offsets[ row ] += this.data.seatInfo.data[ this.data.sector ][ element ][ row ];
}
}
}
}
@@ -93,8 +95,8 @@ export default {
for ( let row = this.startingRow; row < count; row++ ) {
let nn = 2 + ( row - 1 ) * 2;
this.seats[ row ] = {};
for ( let n = ( offsets[ row ] ?? 0 ); n < ( nn + ( offsets[ row ] ?? 0 ) ); n++ ) {
const seatNumber = this.data.numberingDirection === 'right' ? ( Math.floor( w / size ) + ( offsets[ row ] ?? 0 ) ) - n: n;
for ( let n = 0; n < nn; n++ ) {
const seatNumber = this.data.numberingDirection === 'right' ? nn - n: n + ( offsets[ row - 1 ] ?? 0 );
this.seats[ row ][ n ] = {
'style': '',
'id': 'comp' + this.id + 'sec' + this.data.sector + 'r' + row + 's' + seatNumber,