From 268ba19d71e0b2683468bb0d4d7d03ab6384eab1 Mon Sep 17 00:00:00 2001 From: okellogabrielinnocent Date: Mon, 5 Aug 2019 15:49:02 +0300 Subject: [PATCH] bg(venue):implement dynamic venue for specific event - remove the static venue paragraph - add revenue to prop and to the even card --- client/components/cards/EventCard.jsx | 10 ++++++---- server/graphql_schemas/utils/helpers.py | 18 ------------------ 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/client/components/cards/EventCard.jsx b/client/components/cards/EventCard.jsx index e6d0d6de..6fc6501a 100644 --- a/client/components/cards/EventCard.jsx +++ b/client/components/cards/EventCard.jsx @@ -8,9 +8,9 @@ import SlackIcon from '../../assets/icons/SlackIcon'; const EventCard = (props) => { document.title = 'Events page'; const { - id, title, startDate, socialEvent, featuredImage, + id, title, startDate, venue, socialEvent, featuredImage, } = props; - + const date = new Date(startDate); const shortMonths = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; const shortMonth = shortMonths[date.getMonth()]; @@ -22,10 +22,10 @@ const EventCard = (props) => { {title}
-

Lagos

+

{venue}

-

{}

+

{}

@@ -46,6 +46,7 @@ const EventCard = (props) => { EventCard.propTypes = { id: PropTypes.string, title: PropTypes.string, + venue: PropTypes.string, startDate: PropTypes.string, featuredImage: PropTypes.string, socialEvent: PropTypes.objectOf(PropTypes.any), @@ -54,6 +55,7 @@ EventCard.propTypes = { EventCard.defaultProps = { id: '', title: '', + venue: '', startDate: '', socialEvent: {}, featuredImage: '', diff --git a/server/graphql_schemas/utils/helpers.py b/server/graphql_schemas/utils/helpers.py index 520b28c9..ac586131 100644 --- a/server/graphql_schemas/utils/helpers.py +++ b/server/graphql_schemas/utils/helpers.py @@ -134,24 +134,6 @@ def normalize_dates(end_date, start_date, today_date): return {'status': False, 'message': 'Sorry, end date must be after start date'} else: return {'status': True, 'message': 'Validation successful'} - -def validate_event_dates(input): - """ - Validate date fields - :param input: - """ - - event_tz = input.get('start_date').tzinfo - today_date = datetime.datetime.now(event_tz) - start_date = input.get('start_date') - end_date = input.get('end_date') - - if start_date < today_date or end_date < today_date: - return {'status': False, 'message': 'Sorry, you cannot enter a past date'} - elif end_date < start_date: - return {'status': False, 'message': 'Sorry, end date must be after start date'} - else: - return {'status': True, 'message': 'Validation successful'} def not_valid_timezone(timezone): return timezone not in pytz.all_timezones