SHARE
TWEET
Untitled
a guest
Oct 14th, 2016
58
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- mappedSections: (Restangular, sourceId, eventId, priceCategories) => {
- const mappedSections = new Map();
- const promises = []
- //this.prices.forEach((price) => {
- // this.priceCategoryNames.push(price.category);
- //});
- //
- //this.priceCategories.forEach((price) => {
- // priceIndexes.push(this.priceCategoryNames.indexOf(price.category));
- //});
- priceCategories.forEach((price, index) => {
- const promise = Restangular
- .all('events')
- .all(eventId)
- .all('allocated-sections')
- .all(sourceId)
- .get(price.category.split('P')[1]);
- promise.then((sectionArray) => {
- sectionArray.filter(section =>
- section.is_ga
- );
- // Set default blank value to display as '-- Any --'
- sectionArray.unshift({
- is_ga: true,
- name: '-- Any --',
- id: null,
- });
- return sectionArray;
- }).then((sectionArray) => {
- mappedSections.set(priceCategories[index], sectionArray);
- });
- promises.push(promise);
- });
- console.log(promises)
- return Promise.all(promises).then(() => {return mappedSections});
- },
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
