Skip to content

Commit

Permalink
Post order in submit
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasSJacobsen committed Oct 5, 2020
1 parent 4798db4 commit 299f826
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions src/BackOffice/CreateNewEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ const CreateNewEvent = ({
if (formIsValid) {
setSubmitting(true);
const isMentorBoard = availableGroups.indexOf("all") >= 0;
// ALGORITME

if (newSubeventPage) {
fixOrderOnPosts()
}

const event = {
title_NO: titleNO,
Expand Down Expand Up @@ -182,8 +185,7 @@ const CreateNewEvent = ({
/** State som sier om vi øsnker et event med subevents, for å kunne få opp en ny side */
const [newSubeventPage, setNewSubeventPage] = useState(false);

const readyForDatabase = () => {
const isMentorBoard = availableGroups.indexOf("all") >= 0;
const fixOrderOnPosts = () => {

const getGroupOrder = () => {
const order = [];
Expand All @@ -200,22 +202,7 @@ const CreateNewEvent = ({
post.order = [...groupOrder];
});
}

assignGroupOrder();

const event = {
title_NO: titleNO,
title_EN: titleEN,
desc_NO: descNO,
desc_EN: descEN,
day_NO: day,
day_EN: translateDay(day),
from_NO: isMentorBoard ? "fadderstyret" : "gruppeleder",
from_EN: isMentorBoard ? "the mentor board" : "group leader",
start_time: `${startTimeHour}:${startTimeMinute}`,
groups: groups.sort(groupComparator),
};
event.posts = posts
}

return (
Expand Down

0 comments on commit 299f826

Please sign in to comment.