Skip to content

Commit

Permalink
fixed runsheet
Browse files Browse the repository at this point in the history
  • Loading branch information
amykapernick committed Aug 14, 2024
1 parent 87c31cc commit 45d5997
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 17 deletions.
29 changes: 15 additions & 14 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
const colours = require('./src/styles/config/colours.cjs')
const variables = require('./src/styles/config/variables.cjs');
const colours = require(`./src/styles/config/colours.cjs`);
const variables = require(`./src/styles/config/variables.cjs`);

module.exports = {
plugins: [
[
'postcss-advanced-variables',
`postcss-advanced-variables`,
{
variables: {
...colours,
...variables
...variables,
},
}
},
],
'postcss-hexrgba',
`postcss-hexrgba`,
[
'postcss-nesting',
`postcss-nesting`,
{
noIsPseudoSelector: true
}
noIsPseudoSelector: true,
},
],
[
'stylelint',
`stylelint`,
{
configFile: `./config/stylelint.config.cjs`,
fix: true
}
]
fix: true,
quiet: true,
},
],
],
};
};
10 changes: 7 additions & 3 deletions src/types/runsheet.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ export type NotionRunsheetEvent = {
}
Guests: {
rollup: {
array: {
id: string
}[]
array: [
{
relation: {
id: string
}[]
}
]
}
}
GuestIds: {
Expand Down
23 changes: 23 additions & 0 deletions utils/formatRunsheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ const formatRunsheet = (props: formatRunsheetProps) =>
const { sheets, events, guestName, type } = props
let formattedEvents: RunsheetData = {}

console.log({sheets, events})

sheets?.forEach(({ id, name }) =>
{
formattedEvents[id.replaceAll('-', '')] = {
Expand Down Expand Up @@ -92,6 +94,27 @@ const formatRunsheet = (props: formatRunsheetProps) =>
formattedEvents[id].eventIds?.push(event.id)
}
})

event.properties.Guests.rollup.array
.map(array => array.relation
.map(({ id }) => id)
.join(',')
).join(',')
.replaceAll('-', '')
.split(',')
.filter((value, index, self) => self.indexOf(value) === index)
.forEach((id: string) =>
{
if (
formattedEvents?.[id]
&& formattedEvents[id].eventIds
&& !formattedEvents[id].eventIds?.includes(event.id)
)
{
formattedEvents[id].events.push(eventData)
formattedEvents[id].eventIds?.push(event.id)
}
})
}
else if (type === 'vendor')
{
Expand Down

0 comments on commit 45d5997

Please sign in to comment.