Merge branch 'main' of github.com:hainatravel/GHHub

main
Jimmy Liow 10 months ago
commit 6cb61a850a

@ -109,9 +109,11 @@ const chunkBy = (use_year, dataList = [], by = []) => {
aq[cq.WPI_SN] = unique(aq[cq.WPI_SN]); aq[cq.WPI_SN] = unique(aq[cq.WPI_SN]);
return aq; return aq;
}, {}); }, {});
const maxGroupSize = Math.max(...allQuotesSSS.map(q => q.group_size_max));
const maxSet = maxGroupSize === 1000 ? Infinity : maxGroupSize;
// console.log('PGroupSizeSS', structuredClone(PGroupSizeSS)); // console.log('PGroupSizeSS', structuredClone(PGroupSizeSS));
const _SSMinSet = uniqWith(Object.values(PGroupSizeSS), (a, b) => a.join(',') === b.join(',')); const _SSMinSet = uniqWith(Object.values(PGroupSizeSS), (a, b) => a.join(',') === b.join(','));
// console.log('SSMinSet', _SSMinSet); // console.log('SSMinSet', _SSMinSet, maxGroupSize);
const uSSsizeSetArr = uniqueBySub(_SSMinSet); const uSSsizeSetArr = uniqueBySub(_SSMinSet);
// console.log('uSSsizeSetArr', uSSsizeSetArr); // console.log('uSSsizeSetArr', uSSsizeSetArr);
for (const key in PGroupSizeSS) { for (const key in PGroupSizeSS) {
@ -125,7 +127,7 @@ const chunkBy = (use_year, dataList = [], by = []) => {
const [SSsizeSets, PSsizeSets] = [uSSsizeSetArr, []].map((arr) => { const [SSsizeSets, PSsizeSets] = [uSSsizeSetArr, []].map((arr) => {
const _arr = structuredClone(arr); const _arr = structuredClone(arr);
const arrSets = _arr.map(keyMins => keyMins.reduce((acc, curr, idx, minsArr) => { const arrSets = _arr.map(keyMins => keyMins.reduce((acc, curr, idx, minsArr) => {
const _max = idx === minsArr.length - 1 ? Infinity : Number(minsArr[idx + 1])-1; const _max = idx === minsArr.length - 1 ? maxSet : Number(minsArr[idx + 1])-1;
acc.push([Number(curr), _max]); acc.push([Number(curr), _max]);
return acc; return acc;
}, [])); }, []));
@ -141,7 +143,7 @@ const chunkBy = (use_year, dataList = [], by = []) => {
// console.log('pkey', pkey); // console.log('pkey', pkey);
const thisRange = (PGroupSizeSS[rowp.info.id] || []).reduce((acc, curr, idx, minsArr) => { const thisRange = (PGroupSizeSS[rowp.info.id] || []).reduce((acc, curr, idx, minsArr) => {
const _max = idx === minsArr.length - 1 ? Infinity : Number(minsArr[idx + 1])-1; const _max = idx === minsArr.length - 1 ? maxSet : Number(minsArr[idx + 1])-1;
acc.push([Number(curr), _max]); acc.push([Number(curr), _max]);
return acc; return acc;
}, []); }, []);
@ -640,12 +642,13 @@ export default class AgencyContract {
const date2 = shortDate(firstQ.use_dates_end); const date2 = shortDate(firstQ.use_dates_end);
const othersDates = others.map((oq) => `${shortDate(oq.use_dates_start)}~${shortDate(oq.use_dates_end)}`).join(', '); const othersDates = others.map((oq) => `${shortDate(oq.use_dates_start)}~${shortDate(oq.use_dates_end)}`).join(', ');
const otherStr = isEmpty(othersDates) ? '' : `, ${othersDates}`; const otherStr = isEmpty(othersDates) ? '' : `, ${othersDates}`;
const sizeStr = [0,1].includes(firstQ.group_size_min) && firstQ.group_size_max === 1000 ? '不分人等,' : `${firstQ.group_size_min}-${firstQ.group_size_max}人,`;
return new Paragraph({ return new Paragraph({
children: [ children: [
// new TextRun({ text: `${extra.info.product_title} ${firstQ.unit_name}`, bold: true }), // new TextRun({ text: `${extra.info.product_title} ${firstQ.unit_name}`, bold: true }),
new TextRun({ new TextRun({
text: text:
`${firstQ.group_size_min}-${firstQ.group_size_max}人, ${firstQ.unit_name}, ${firstQ.adult_cost}` + `${sizeStr} ${firstQ.unit_name}, ${firstQ.adult_cost}` +
// + (`, ${firstQ.group_size_min}-${firstQ.group_size_max}`) // + (`, ${firstQ.group_size_min}-${firstQ.group_size_max}`)
(compactBy !== 'dates' ? `, ${date1}~${date2}${otherStr}` : ''), (compactBy !== 'dates' ? `, ${date1}~${date2}${otherStr}` : ''),
}), }),

Loading…
Cancel
Save