Skip to content

Commit

Permalink
sort workshops
Browse files Browse the repository at this point in the history
  • Loading branch information
McFrid committed Oct 24, 2024
1 parent b377571 commit 97625dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@focus-reactive/graphql-content-layer",
"version": "3.1.28",
"version": "3.1.29",
"private": false,
"main": "dist/index.js",
"scripts": {
Expand Down
11 changes: 10 additions & 1 deletion src/fetch-workshops.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ const fetchData = async (client, vars) => {
additionalInfo: await markdownToHtml(wrp.additionalInfo),
prerequisites: await markdownToHtml(wrp.prerequisites),
finishingTime: '',
startDate:
wrp.startDate || dayjs(wrp.location, 'MMMM D, HH').toISOString(),
})),
);

Expand Down Expand Up @@ -220,10 +222,17 @@ const fetchData = async (client, vars) => {
),
);

const sortedWorkshops = allWorkshops.sort((a, b) => {
return (
Number(a.includedToPackage) - Number(b.includedToPackage) ||
new Date(a.startDate).getTime() - new Date(b.startDate).getTime()
);
});

return {
trainers,
workshopDays: data.length,
workshops: allWorkshops,
workshops: sortedWorkshops,
speakers: {
workshops: trainers,
},
Expand Down

0 comments on commit 97625dd

Please sign in to comment.