Skip to content

Commit

Permalink
Small bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Magnus committed Nov 10, 2020
1 parent 74efa8a commit cfce2d4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 35 deletions.
15 changes: 8 additions & 7 deletions src/BackOffice/CreateNewEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const CreateNewEvent = ({
) === -1,
link: (linkTextEN.length !== 0 || linkTextNO.length !== 0) && !link,
groups: groups.length === 0,
postGroupsAssigned: newSubeventPage && (
postGroupsAssigned: newSubeventPage && ( // Sjekk at alle grupper er tildelt en post
groups.includes("all") ?
availableGroups
.filter(group => group !== "all")
Expand All @@ -148,8 +148,12 @@ const CreateNewEvent = ({
.some(group => !posts.map(post => post.startGroup)
.includes(group))
),
postStartTime: newSubeventPage && (startTimeHourPosts.length !== 2 || startTimeMinutePosts.length !== 2),
postTime: newSubeventPage && postTime.length === 0,
postStartTime: newSubeventPage && // Sjekk at starttid poster er fylt ut og ikke er før starttid event
(startTimeHourPosts.length !== 2 ||
startTimeMinutePosts.length !== 2 ||
startTimeHourPosts < startTimeHour ||
(startTimeHourPosts === startTimeHour && startTimeMinutePosts < startTimeMinute)),
postTime: newSubeventPage && parseInt(postTime) < 0,
postTitle: newSubeventPage && posts.some(post => post.title === ""),
postGroup: newSubeventPage && posts.some(post => post.startGroup === ""),
};
Expand Down Expand Up @@ -265,12 +269,9 @@ const CreateNewEvent = ({
obligatoriske.
</div>
{/** *********************************************************** **/}
{
//TODO: For å endre til at data blir sendt til databasen så uncomment linje 237, og kommenter ut linjen over **/
}

<Form
className="create-event-form"
//onSubmit={readyForDatabase}
onSubmit={submit}
loading={!availableGroups || submitting}
>
Expand Down
5 changes: 4 additions & 1 deletion src/BackOffice/EventWithPosts.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ const EventWithPosts = ({ selectedGroups, posts, setPosts, setPostTime, postTime
placeholder="00"
value={ postTime }
onChange={(_, data) => {
for (const c of data.value.split("")) {
if (c < "0" || c > "9") return;
}
setPostTime(data.value);
setErrors({...errors, postTime: false})
}}
type="number"
type="text"
autoComplete="off"
/>
</Form.Field>
Expand Down
22 changes: 0 additions & 22 deletions src/BackOffice/form-fields/PostDropDown.js

This file was deleted.

5 changes: 1 addition & 4 deletions src/Frontend/textResources.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@ const textResources = {
ERROR_GROUPS_NO: "Du må velge gruppe(r) arrangementet gjelder for",
ERROR_LINK_NO: "Du kan ikke ha lenketekst uten lenke",
ERROR_POST_GROUPS_ASSIGNED_NO: "Alle grupper må starte på en post",
ERROR_POST_START_TIME_NO: "Ugyldig starttid",
ERROR_POST_START_TIME_NO: "Starttidspunkt for poster kan ikke være tidligere enn starttidspunkt for event",
ERROR_POST_TIME_NO: "Ugyldig tid på poster",
ERROR_POST_TITLE_NO: "Alle poster må ha en tittel",
ERROR_POST_GROUP_NO: "Alle poster må ha en startgruppe",

/** Poster error **/
ERROR_NAVN_POST: "Du må fylle ut navn på alle postene",

/** PHONE **/
EMERGENCY_PHONE_NUMBER_NO: "Vakttelefon",
EMERGENCY_PHONE_NUMBER_EN: "Mentor board",
Expand Down
2 changes: 1 addition & 1 deletion src/Frontend/utils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const selectGroups = ({ groups }, lang) => {

const calculateEndTime = (startTime, minUsed) => {
const hours_min = startTime.split(":");
let end_hour = parseInt(hours_min[0]) + Math.floor((parseInt(hours_min[1])+ parseInt(minUsed)) / 60);
let end_hour = (parseInt(hours_min[0]) + Math.floor((parseInt(hours_min[1])+ parseInt(minUsed)) / 60)) % 24;
let end_minute = (parseInt(hours_min[1]) + parseInt(minUsed)) % 60;
return `${end_hour < 10 ? "0" : ""}${end_hour}:${end_minute < 10 ? "0" : ""}${end_minute}`
}
Expand Down

0 comments on commit cfce2d4

Please sign in to comment.