Exemple #1
0
class TestEvent(TestSuite):
    event1 = Event({
        'event_id': 1,
        'name': 'Test Event',
        'group_name': 'wmensxc',
        'start_date': datetime.fromisoformat('2019-11-09').date(),
        'end_date': None,
        'start_time': None,
        'end_time': None,
        'description': 'Test Event',
        'deleted': False
    })

    event2 = Event({
        'event_id': 2,
        'name': 'Another Test Event',
        'group_name': 'wmenstf',
        'start_date': datetime.fromisoformat('2019-11-10').date(),
        'end_date': None,
        'start_time': None,
        'end_time': None,
        'description': 'Another Test Event',
        'deleted': False
    })

    def test_event_str(self) -> None:
        """
        Prove that the human readable string representation of an Comment object is as expected.
        """
        self.assertEquals(
            str(self.event1),
            'Event: [event_id: 1, name: Test Event, group_name: wmensxc, start_date: 2019-11-09, '
            'end_date: None, start_time: None, end_time: None, description: Test Event, deleted: False]'
        )
        self.assertEquals(
            self.event1.__str__(),
            'Event: [event_id: 1, name: Test Event, group_name: wmensxc, start_date: 2019-11-09, '
            'end_date: None, start_time: None, end_time: None, description: Test Event, deleted: False]'
        )

    def test_event_repr(self) -> None:
        """
        Prove that the machine readable string representation of an Event object is as expected.
        """
        self.assertEquals(repr(self.event1), "<Event 'Test Event'>")
        self.assertEquals(self.event1.__repr__(), "<Event 'Test Event'>")

    def test_event_eq(self) -> None:
        """
        Prove that two Event objects with the same property values test positive for value equality.
        """
        self.assertTrue(self.event1 == self.event1)
        self.assertTrue(self.event1.__eq__(self.event1))

    def test_event_ne(self) -> None:
        """
        Prove that two Event objects with different property values test negative for value equality.
        """
        self.assertTrue(self.event1 != self.event2)
        self.assertTrue(self.event1.__ne__(self.event2))
    def instantiateDomainModel(self, RawCoT):
        if RawCoT.status == 'on':
            self.modelObject = Event("emergencyOn")
            root = RawCoT.xmlString
            #establish variables
            self.event = etree.XML(root)
            self.detail = self.event.find('detail')
            self.link = self.detail.find('link')
            self.contact = self.detail.find('contact')
            self.emergency = self.detail.find('emergency')

            #instantiate model
            self.eventAtrib()
            self.linkAtrib()
            self.contactAtrib()
            self.emergencyAtrib()

        elif RawCoT.status == 'off':
            self.modelObject = Event("emergencyOff")
            root = RawCoT.xmlString
            RawCoT.xmlString = root

            #establish variables
            self.event = etree.XML(root)
            self.detail = self.event.find('detail')
            self.emergency = self.detail.find('emergency')
            self.point = self.event.find('point')

            #instantiate model
            self.eventAtrib()
            self.pointAtrib()
            self.emergencyAtrib()
        return self.modelObject
Exemple #3
0
    def add(self, params):
        
        event = Event(
            name = params["name"],
            file = params["file"],
            file150 = params["file150"],
            filetype = params["filetype"].split('.')[1],
            start_date = params["start_date"],
#            end_date = params["end_date"],
            description = params["description"],
            creator = params["creator"],
#            people_invited = params["people_invited"],
#            type = params["type"],
            
            
        )
        event.put()
        list = params["people_invited"]
        for l in list:
            iu = InvitedUser(
                             email = l,
                             event = event
                             )
            queue = Queue('mail-queue')
            subject =  "You have been invited to the event " + event.name + " in Rockolin'"
            body = """     Hi!, You have been invited to the event """ + event.name + """
                    This event would be on: """ + str(event.start_date) + """ 
                    If you want to decide the music justo go to the following 
                    link: http://rockolinapp.appspot.com/event/""" +str(event.key())
            
            queue.add(Task(url='/task/mail', params = { 'to' : l, 'subject' : subject, 'body' : body }))        
            iu.put()
        queue.purge()
        song_list = params["setlist"] 
        
        for s in params["setlist"]:
            song = Song.get(s)
            slv = SetListVotes(
                               event = event,
                               song = song,
                               
                               votes = 0
                               
                               )
            slv.put()
            
            
        return event
    def __init__(self, RawCoT):

        self.m_SendOther = SendOther()
        self.m_SendOther.clientInformation = RawCoT.clientInformation
        self.m_SendOther.modelObject = Event('other')
        self.instantiateDomainModel(RawCoT)
        self.m_SendOther.xmlString = RawCoT.xmlString
 def run(self, event: Event):
     self.__sensors_repository.update(event.model)
     sensor_persisted_event = Event(Event.TYPE_SENSOR_PERSISTED,
                                    event.model)
     self.__get_configured_async_jobs().publish(sensor_persisted_event)
     self.__logging.info(
         "Event persisted with id: {0} and value {1}".format(
             event.model.id, event.model.latest_value))
 def put(self, id):
     self.set_status(200)
     sensor_data = json.loads(self.request.body.decode("utf-8"))
     self.__logging.info('Sensor data received: '.format(
         self.request.body.decode("utf-8")))
     sensor = Sensor(id, sensor_data['type'], sensor_data['value'], None)
     event = Event(Event.TYPE_SENSOR_RECEIVED, sensor)
     self.__async_jobs.publish(event)
Exemple #7
0
 def post(self, key, **kwargs):
     event = Event.get(key)
     email = self.form.email.data
     invited_users = event.event_user_invited
     for iu in invited_users:
         if email == iu.email:
             return self.redirect('/event/'+str(event.key()))
         else: 
             self.messages.append(('This email was not invited to this event',
                         'error'))
             return self.get(key,**kwargs)
Exemple #8
0
def select_event(event_name):
	if event_name+".json" in os.listdir('./model/saved_events/'):
		file_name = './model/saved_events/{}.json'.format(event_name)
		with open(file_name, 'r') as f:
			content = f.read()
			event = Event(name=None)
			e = json.loads(content)
			event.__dict__.update(e)
		return event
	else:
		print('Evento não encontrado!!!')
Exemple #9
0
 def get(self,key, **kwargs):
         event = Event.get(key)
         if self.auth.user:
         # User is already registered, so don't display the signup form.
             return self.redirect('/event/'+str(key))
 
         opts = {'continue': self.redirect_path(),'event':key}
         context = {
             'facebook_login_url':   self.url_for('auth/invite/facebook', **opts),
             'twitter_login_url':    self.url_for('auth/invite/twitter', **opts)
             
         }
         
         return self.render_response('validate_user.html',section='validate_user',form = self.form,event=event, **context)
Exemple #10
0
 def getFile(self, key,size):
 
     event = Event.get(key)
     file = None
     if size == 90:
         file = event.file
     else:
         file = event.file150
         
     result = {
             "file": file,
             "name": str(event.key())+"."+event.filetype
     
             }
     
     return result
Exemple #11
0
 def intstantiateClientInformationModelFromConnection(
         self, rawClientInformation, queue):
     try:
         self.m_clientInformation = ClientInformation()
         argument = "initialConnection"
         self.m_clientInformation.dataQueue = queue
         self.modelObject = Event(argument)
         self.m_clientInformation.socket = rawClientInformation[0]
         self.m_clientInformation.IP = rawClientInformation[1]
         self.m_clientInformation.idData = rawClientInformation[2]
         self.m_clientInformation.alive = 1
         self.m_clientInformation.ID = uuid.uuid1().int
         super().__init__(self.m_clientInformation.idData, self.modelObject)
         self.m_clientInformation.modelObject = self.modelObject
         return self.m_clientInformation
     except Exception as e:
         logger.error('error in client information controller ' + str(e))
Exemple #12
0
    def editEvent(self,
                  name,
                  dt_start,
                  dt_end,
                  address,
                  hr_start=None,
                  hr_end=None,
                  description=None):
        event = Event(name, address, dt_start, dt_end, hr_start, hr_end,
                      description)
        print(event)

        #TODO
        #EventDAO.remove_event(event)
        EventDAO.save_event(event)

        self.event = event
        self.notify()
    def CreateEvent(self,
                    name,
                    dt_start,
                    dt_end,
                    address,
                    hr_start=None,
                    hr_end=None,
                    description=None):

        event = Event(name, address, dt_start, dt_end, hr_start, hr_end,
                      description)

        print(event)
        EventDAO.save_event(event)
        # atualiza modelo

        self.notify()
        pass
Exemple #14
0
 def post(self, **kwargs):
     song = Song.get(self.request.form.get('idsong'))
     event = Event.get(self.request.form.get('idevent'))
     sum =  int(self.request.form.get('sum'))
     params = {
                 "event": event,
                 "song": song,
                 "sum": sum
             
           }
     manager = SetListVotesDelegate('SetListVotes')
     manager.update(params)
     slv = event.event_setlist.order('-votes')
     i = 0
     votes = 0
     for s in slv:
         if s.song.key() == song.key():
             votes = s.votes
             break
         i=i+1
     list = {'position' : i,'votes':votes}
     return json.dumps(list)
Exemple #15
0
def select_all_events():
	files = glob.glob('./model/saved_events/*.json')
	events = []
	for f in files:
		with open(f, 'r') as nf:
			content = nf.read()
			event = Event(name=None)
			e = json.loads(content)

			if e['_Event__start_date'] is not None:
				d_start = e['_Event__start_date']
				d_start = list(map(int, d_start.split('/')))
				d_start.reverse()
				e['_Event__start_date'] = dt_date(*d_start)

			if e['_Event__end_date'] is not None:
				d_end = e['_Event__end_date']
				d_end = list(map(int, d_end.split('/')))
				d_end.reverse()
				e['_Event__end_date'] = dt_date(*d_start)

			event.__dict__.update(e)
			events.append(event)
	return events
Exemple #16
0
# coding=utf-8
from model.Event import Event

# Events to search for
HAPPY_EVENTS = [
    Event(['فطر', 'عيد', 'سعيد', 'كل عام و أنتم بخير'], '2016-7-5', '2016-7-8', ['مصر', 'السعودية']),
    Event(['الفطر', 'عيد', 'سعيد', 'كل عام و أنتم بخير'], '2017-6-24', '2017-6-27', ['مصر', 'السعودية']),
    Event(['فطر', 'عيد', 'سعيد', 'كل عام و أنتم بخير'], '2018-6-14', '2018-6-16', ['مصر', 'السعودية']),

    Event(['الأضحى', 'عيد', 'سعيد', 'كل عام و أنتم بخير'], '2016-9-11', '2016-9-15', ['مصر', 'السعودية']),
    Event(['الأضحى', 'عيد', 'سعيد', 'كل عام و أنتم بخير'], '2017-8-31', '2018-9-4', ['مصر', 'السعودية']),
    Event(['الأضحى', 'عيد', 'سعيد', 'كل عام و أنتم بخير'], '2018-8-20', '2018-8-24', ['مصر', 'السعودية']),

    Event(['المولد', 'كل عام وانتم بخير'], '2016-12-10', '2016-12-10', ['مصر', 'السعودية']),
    Event(['المولد', 'كل عام وانتم بخير'], '2017-11-30', '2017-12-1', ['مصر', 'السعودية']),
    Event(['المولد', 'كل عام وانتم بخير'], '2018-11-19', '2018-11-21', ['مصر', 'السعودية']),

    Event(['السنة الهجرية', 'كل عام وانتم بخير'], '2016-10-1', '2016-10-1', ['مصر', 'السعودية']),
    Event(['السنة الهجرية', 'كل عام وانتم بخير'], '2017-9-20', '2017-9-21', ['مصر', 'السعودية']),
    Event(['السنة الهجرية', 'كل عام وانتم بخير'], '2018-9-10', '2018-9-11', ['مصر', 'السعودية']),

    Event(['المسيح', 'كريسمس', 'عيد مجيد', 'ميلاد', "سعيد"], '2016-12-24', '2016-12-25', ['مصر', 'السعودية']),
    Event(['المسيح', 'كريسمس', 'عيد مجيد', 'ميلاد', "سعيد"], '2017-12-24', '2017-12-25', ['مصر', 'السعودية']),
    Event(['المسيح', 'كريسمس', 'عيد مجيد', 'ميلاد', "سعيد"], '2018-12-24', '2018-12-25', ['مصر', 'السعودية']),

    Event(['رأس السنة', 'كل عام و أنتم بخير'], '2016-12-31', '2017-1-1', ['مصر', 'السعودية']),
    Event(['رأس السنة', 'كل عام و أنتم بخير'], '2017-12-31', '2018-1-1', ['مصر', 'السعودية']),
    Event(['رأس السنة', 'كل عام و أنتم بخير'], '2018-12-31', '2019-1-1', ['مصر', 'السعودية']),

    Event(['الأم'], '2016-03-21', '2016-03-22', ['مصر', 'السعودية']),
    Event(['الأم'], '2017-03-21', '2017-03-22', ['مصر', 'السعودية']),
Exemple #17
0
 def listEvents(self,user):
     events = Event.all().filter('creator =', user )
     return events
Exemple #18
0
 def get(self,key, **kwargs):
     if self.auth.user:
         slv = Event.get(key).event_setlist.order('-votes')
         return self.render_response('event.html',section='event',setlist = slv,event=Event.get(key))
     else:
         return self.redirect('/event/invitation/'+str(key))
from model.Event import Event
from model.EventAdmin import EventAdmin
from model.MemoryAdmin import MemoryAdmin

event_admin = EventAdmin()
event_admin.add_event(Event("LLEGA", "P1", 78))
event_admin.add_event(Event("LLEGA", "P2", 82))
event_admin.add_event(Event("LLEGA", "P3", 60))
event_admin.add_event(Event("LLEGA", "P4", 94))
event_admin.add_event(Event("LLEGA", "P5", 74))
event_admin.add_event(Event("TERMINA", "P3", -1))
event_admin.add_event(Event("LLEGA", "P6", 96))
event_admin.add_event(Event("TERMINA", "P2", -1))
event_admin.add_event(Event("LLEGA", "P7", 74))
event_admin.add_event(Event("TERMINA", "P5", -1))
event_admin.add_event(Event("TERMINA", "P1", -1))
event_admin.add_event(Event("LLEGA", "P8", 44))
event_admin.add_event(Event("LLEGA", "P9", 28))

memory_admin = MemoryAdmin(512, 64, event_admin)
memory_admin.run()
Exemple #20
0
 def get(self,key, **kwargs):
     
     
     people = Event.get(key).event_user_invited.filter('status =','voted')
     
     return self.render_response('event_stats.html',people=people)