|
|
@ -25,6 +25,43 @@ export class PortfolioComponent implements OnInit { |
|
|
|
|
|
|
|
this.apisService.getPortfolio(this.section).toPromise().then((response) => { |
|
|
|
this.portfolioItems = response.items |
|
|
|
|
|
|
|
let cnt = 0 |
|
|
|
let width = 0 |
|
|
|
let tot = 0 |
|
|
|
|
|
|
|
this.portfolioItems.forEach((e) => { |
|
|
|
switch (cnt) { |
|
|
|
case 0: |
|
|
|
width = Math.floor(Math.random()*3)+3 |
|
|
|
tot = width |
|
|
|
cnt++ |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
width = Math.floor(Math.random()*3)+3 |
|
|
|
cnt++ |
|
|
|
|
|
|
|
if(tot + width > 9) { |
|
|
|
width = 12 - tot |
|
|
|
tot = 0 |
|
|
|
cnt = 0 |
|
|
|
} else { |
|
|
|
tot = tot + width |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
case 2: |
|
|
|
width = 12 - tot |
|
|
|
tot = 0 |
|
|
|
cnt = 0 |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
e.width = width |
|
|
|
|
|
|
|
//((e.id % 5)+3)
|
|
|
|
//Math.floor((Math.random()*3)+1)+2
|
|
|
|
}) |
|
|
|
},(error) => { |
|
|
|
console.error('getPortfolio ERROR', error) |
|
|
|
}).catch((e) => { |
|
|
|