コード例 #1
0
    def similarMeetings_does_not_match_two_meetings_with_dissimilar_names (world):
        stored_meeting = Meeting.objects.create(title='My New Meeting')
        meeting = Meeting(title='Strange Other One')

        assert_equal(
            meeting.similar_meetings(),
            []
        )
コード例 #2
0
    def has_slug_on_save (self):
        Meeting.objects.all().delete()
        instance = Meeting(title='hello, world!')
        instance.save()

        assert_equal(
            instance.slug,
            'hello-world'
        )
コード例 #3
0
    def similarMeetings_matches_two_meetings_with_similar_names (world):
        # If this test is failing, remember to import division from __future__
        # wherever you're calculating the similarity.

        stored_meeting = Meeting.objects.create(title='My New Meeting')
        meeting = Meeting(title='my newest meeting')

        assert_equal(
            meeting.similar_meetings(),
            [stored_meeting]
        )
コード例 #4
0
    def test_no_repeat(self):
        meeting = Meeting(start=datetime.combine(TODAY, time(12)),
                          repeat_type=Meeting.REPEAT_TYPES.once)

        create, remove = sync_meeting_repetitions_internal(meeting, [], TODAY)
        self.assertEqual(1, len(create))
        self.assertEqual(0, len(remove))
        self.assertEqual(TODAY, create[0].date)
コード例 #5
0
    def test_no_repeat_in_past(self):
        date_in_past = TODAY - timedelta(days=3)
        meeting = Meeting(start=datetime.combine(date_in_past, time(12)),
                          repeat_type=Meeting.REPEAT_TYPES.once)

        create, remove = sync_meeting_repetitions_internal(meeting, [], TODAY)
        self.assertEqual(1, len(create))
        self.assertEqual(0, len(remove))
        self.assertEqual(date_in_past, create[0].date)
コード例 #6
0
ファイル: tests.py プロジェクト: dennereed/paleoanthro
 def test_last_membership_year_method(self):
     john = Member.objects.get(last_name='Lennon')  # get John
     self.assertEqual(john.last_membership_year(), Meeting.get_current_meeting_year())  # Test John's recent membership
     self.assertNotEqual(john.last_membership_year(), 2014)
     paul = Member.objects.get(last_name='Mcartney')
     self.assertEqual(paul.last_membership_year(), 2014)
     george = Member.objects.get(last_name='Harrison')
     self.assertEqual(george.last_membership_year(), 'None')
     ringo = Member.objects.get(last_name='Star')
     self.assertEqual(ringo.last_membership_year(), 'None')
コード例 #7
0
    def test_create_every_day_without_limit(self):
        start = date(2017, 4, 7)
        meeting = Meeting(start=datetime.combine(start, time(12)),
                          repeat_type=Meeting.REPEAT_TYPES.every_day,
                          repeat_interval=2)

        create, remove = sync_meeting_repetitions_internal(meeting, [], TODAY)
        self.assertEqual(0, len(remove))
        self.assertEqual(911, len(create))  # 911 ~= (5 * 365 + 1 - 5) / 2
        self.assertEqual(date(2017, 4, 7), create[0].date)
        self.assertEqual(date(2017, 4, 9), create[1].date)
コード例 #8
0
    def test_create_every_week_with_end_date(self):
        start = date(2017, 4, 9)  # Sunday
        meeting = Meeting(start=datetime.combine(start, time(12)),
                          repeat_type=Meeting.REPEAT_TYPES.every_week,
                          repeat_end_date=date(2017, 5, 7),
                          repeat_interval=1)  # note every week

        create, remove = sync_meeting_repetitions_internal(meeting, [], TODAY)
        self.assertEqual(0, len(remove))
        self.assertEqual(5, len(create))
        self.assertEqual(date(2017, 4, 9), create[0].date)
        self.assertEqual(date(2017, 4, 16), create[1].date)
        self.assertEqual(date(2017, 5, 7), create[4].date)
コード例 #9
0
    def test_create_every_workday_with_max_count(self):
        start = date(2017, 4, 9)  # Sunday
        meeting = Meeting(start=datetime.combine(start, time(12)),
                          repeat_type=Meeting.REPEAT_TYPES.every_work_day,
                          repeat_max_count=10,
                          repeat_interval=2)

        create, remove = sync_meeting_repetitions_internal(meeting, [], TODAY)
        self.assertEqual(0, len(remove))
        self.assertEqual(10, len(create))
        self.assertEqual(date(2017, 4, 11),
                         create[0].date)  # every 2-nd day if it's a workday
        self.assertEqual(date(2017, 4, 13), create[1].date)
コード例 #10
0
ファイル: tests.py プロジェクト: dennereed/paleoanthro
    def setUp(self):
        john = Member.objects.create(last_name="Lennon", first_name="John", member=True, registered=True)
        paul = Member.objects.create(last_name="Mcartney", first_name="Paul", member=True, registered=False)
        george = Member.objects.create(last_name="Harrison", first_name="George", member=False, registered=True)
        ringo = Member.objects.create(last_name="Star", first_name="Ringo", member=False, registered=False)
        buggsy = Member.objects.create(last_name='Bugglesworth', first_name='Paul', member=True, registered=False)

        cy = Meeting.get_current_meeting_year()

        Membership.objects.create(member=john, year=2014, payment_type='M')  # John is a member in 2014
        Membership.objects.create(member=john, year=2015, payment_type='M')  # John is a member in 2015
        Membership.objects.create(member=john, year=cy, payment_type='M')  # John is a current member
        Membership.objects.create(member=john, year=2015, payment_type='R')  # John registered for meetings in 2015
        Membership.objects.create(member=paul, year=2014, payment_type='M')  # Paul is a member in 2014
        # Paul is not registered for 2015 meeting
        # George is not a member in 2015
        Membership.objects.create(member=george, year=2015, payment_type='R')  # George registered for meetings in 2015
コード例 #11
0
    def test_every_month_in_bad_tz(self):
        start = date(2017, 5, 29)  # 29 May 2017 = Monday, 5-th Monday
        moscow = pytz.timezone('Europe/Moscow')
        meeting = Meeting(
            # For some reason 2 a.m. 29 Jul - this is 11 p.m. 28 May UTC = 4-th Sunday
            start=make_aware(datetime.combine(start, time(2)),
                             timezone=moscow),
            repeat_type=Meeting.REPEAT_TYPES.every_month,
            repeat_max_count=5,
            repeat_interval=1)

        create, remove = sync_meeting_repetitions_internal(meeting, [],
                                                           TODAY,
                                                           timezone=moscow)
        self.assertEqual(0, len(remove))
        self.assertEqual(5, len(create))
        self.assertEqual(date(2017, 5, 28),
                         create[0].date)  # dates are UTC, so shifted
        self.assertEqual(date(2017, 6, 25), create[1].date)
        self.assertEqual(date(2017, 7, 30),
                         create[2].date)  # 30 July - UTC, it's 5-th Sunday
コード例 #12
0
    def test_sync(self):
        start = date(2017, 4, 1)
        meeting = Meeting(start=datetime.combine(start, time(12)),
                          repeat_type=Meeting.REPEAT_TYPES.every_day,
                          repeat_end_date=date(2017, 4, 14),
                          repeat_interval=1)

        existing = [
            date(2017, 3, 29),
            date(2017, 3, 31),
            date(2017, 4, 2),
            date(2017, 5, 1)
        ]

        create, remove = sync_meeting_repetitions_internal(
            meeting, existing, TODAY)

        self.assertEqual(3, len(remove))
        self.assertEqual(13, len(create))
        self.assertIn(date(2017, 3, 29), remove)
        self.assertEqual(date(2017, 4, 1), create[0].date)
        self.assertEqual(date(2017, 4, 3), create[1].date)
        self.assertEqual(date(2017, 4, 4), create[2].date)
コード例 #13
0
ファイル: create_meeting_test.py プロジェクト: kahihia/OpComm
    def test_create_meeting(self):
        self.issues = [
            self.c.issues.create(
                created_by=self.chair[0],
                status=IssueStatus.IN_UPCOMING_MEETING,
                order_in_upcoming_meeting=i + 1,

            ) for i in xrange(20)
        ]

        self.assertEquals(20, self.c.upcoming_issues().count())

        self.c.upcoming_meeting_participants.add(self.members[-1])
        self.c.upcoming_meeting_participants.add(self.members[-2])
        self.c.upcoming_meeting_participants.add(self.members[-3])
        self.c.upcoming_meeting_participants.add(self.chair[0])

        m = Meeting(held_at=timezone.now())
        self.c.close_meeting(m, self.chair[0], self.c)

        self.assertEquals(20, m.agenda_items.count())
        self.assertEquals(4, m.participations.filter(is_absent=False).count())
        self.assertEquals(7, m.participations.filter(is_absent=True).count())
コード例 #14
0
ファイル: views.py プロジェクト: MrVictor42/Grata-Backend-v2
    def post(self, request, *args, **kwargs):

        meeting = Meeting()

        project = Project.objects.get(id=request.data.get('project'))
        meeting_leader = User.objects.get(
            id=request.data.get('meeting_leader'))

        meeting.title = request.data.get('title')
        meeting.status = request.data.get('status')
        meeting.slug = slugify(meeting.title)
        meeting.initial_date = request.data.get('initial_date')
        meeting.initial_hour = request.data.get('initial_hour')
        meeting.subject_matter = request.data.get('subject_matter')
        meeting.project = project
        meeting.meeting_leader = meeting_leader
        meeting.duration_time = None
        meeting.real_hour = None
        meeting.real_date = None
        meeting.questtionaire = None

        meeting.save()
        serializer = MeetingSerialize(instance=meeting, data=request.data)
        serializer.is_valid(raise_exception=True)

        return Response(serializer.data)
コード例 #15
0
ファイル: utils.py プロジェクト: jakeprem/codemash_django
def _ingest_meeting(meeting):
    new_meeting = Meeting()
    new_meeting.id = meeting['Id']
    new_meeting.title = meeting['Title']
    new_meeting.abstract = meeting['Abstract']
    new_meeting.session_time = meeting['SessionTime']
    new_meeting.save()
    new_meeting.room = meeting['Room']
    new_meeting.start_datetime = meeting['SessionStartTime']
    new_meeting.end_datetime = meeting['SessionEndTime']

    for speaker in meeting['Speakers']:
        new_meeting.speakers.add(speaker['Id'])

    for tag in meeting['Tags']:
        tag_model, created = Tag.objects.get_or_create(text=tag)
        new_meeting.tags.add(tag_model)

    session_type_model, created = SessionType.objects.get_or_create(
        text=meeting['SessionType'])
    new_meeting.session_type = session_type_model

    category_model, created = Category.objects.get_or_create(
        text=meeting['Category'])
    new_meeting.category = category_model

    for room in meeting['Rooms']:
        room_model, created = Room.objects.get_or_create(text=room)
        new_meeting.rooms.add(room_model)

    new_meeting.save()
コード例 #16
0
def create(request):
    new_meeting_object = Meeting(name = request.POST['meeting_name'], pub_date=timezone.now(), user_name=request.POST['user_name']);
    new_meeting_object.save();
    return HttpResponseRedirect(reverse('meetings:availability_organizer', args=(new_meeting_object.id,)))
コード例 #17
0
ファイル: models.py プロジェクト: dennereed/paleoanthro
 def get_current_membership_year(self):
     return Meeting.get_current_meeting_year()
コード例 #18
0
ファイル: models.py プロジェクト: dennereed/paleoanthro
 def is_current_member(self):
     if self.last_membership_year() == Meeting.get_current_meeting_year():
         return True
     else:
         return False
コード例 #19
0
ファイル: functions.py プロジェクト: ayoubar/aperta-cms
def import_data(ty, data):

    nb = 0
    ok = True
    errors = False
    for l in UnicodeDictReader(data, delimiter=';', quoting=csv.QUOTE_NONE):
        debug('upload', u'Line : ' + str(l))

        Model = None
        if ty == 'members':  #import members
            try:
                Model = Member.objects.get(first_name=str(l['PRENOM']),
                                           last_name=str(l['NOM']),
                                           email=str(l['EMAIL']))
            except Member.DoesNotExist:
                Model = Member(first_name=str(l['PRENOM']),
                               last_name=str(l['NOM']),
                               address=str(l['ADRESSE']),
                               phone=str(l['TEL']),
                               mobile=str(l['MOBILE']),
                               email=str(l['EMAIL']))
                # create user
                U = create_user(Model.first_name, Model.last_name, Model.email)
                Model.user = U
                Model.save()
                nb += 1

        if ty == 'calendar':  #import calendar
            deadline = timezone.make_aware(
                datetime.strptime(l['DATE'] + ' ' + l['HEURE'],
                                  "%Y-%m-%d %H:%M") - timedelta(hours=24),
                None)
            if l['TYPE'] == '0':  #meeting
                debug('upload', u"it's a meeting")
                try:
                    Model = Meeting.objects.get(when=str(l['DATE']),
                                                title=str(l['TITRE']))
                except Meeting.DoesNotExist:
                    Model = Meeting(
                        title=str(l['TITRE']),
                        when=str(l['DATE']),
                        time=str(l['HEURE']),
                        deadline=deadline,
                    )

            if l['TYPE'] == '1':  #event
                debug('upload', u"it's an event")
                try:
                    Model = Event.objects.get(when=str(l['DATE']),
                                              title=str(l['TITRE']))
                except Event.DoesNotExist:
                    Model = Event(
                        title=str(l['TITRE']),
                        when=str(l['DATE']),
                        time=str(l['HEURE']),
                        deadline=deadline,
                    )

            # check/create location
            location = None
            try:
                location = Location.objects.get(name=str(l['LIEU']))
            except Location.DoesNotExist:
                location = Location(name=str(l['LIEU']))
                location.save()

            Model.location = location
            if l['TYPE'] == '0':  #add num to meeting title
                latest = Meeting.objects.values().latest('num')
                next_num = latest['num'] + 1
                Model.num = next_num
                Model.title = str(next_num) + u'. ' + str(Model.title)
            Model.save()
            nb += 1

    if not ok: return errors
    else: return nb
コード例 #20
0
ファイル: models.py プロジェクト: dennereed/paleoanthro
 def is_currently_registered(self):
     if self.last_registration_year() == Meeting.get_current_meeting_year():
         return True
     else:
         return False
コード例 #21
0
ファイル: views.py プロジェクト: optimizium/bbbmanager
    def post(self, request, *args, **kwargs):
        print "-------------------------"
        meeting_name = request.POST.get('meeting_name','')
        meeting_id = str(randint(0,90909090)) #request.POST.get('meeting_id','')
        meeting_time = request.POST.get('meeting_time','')
        #meeting_duration = request.POST.get('meeting_duration','')
        attendee_password = request.POST.get('attendee_password','')
        moderator_password = request.POST.get('moderator_password','')
	bbm_obj = BBBMeeting(meeting_id,meeting_name,moderator_password,attendee_password,"http://google.com")
	resp = bbm_obj.start()	
	mid = Meeting()
	mid.name = meeting_name
	mid.meetingID = meeting_id
	mid.meeting_duration = '5'#meeting_duration 
	mid.attendee_passwd = attendee_password
	mid.moderator_passwd = moderator_password
	mid.meeting_datetime = meeting_time
 	mid.meeting_logout_url = "http://google.com"
	print dir(User)
	mid.created_by = request.user
	mid.save()
	
   	join_url = bbm_obj.moderator_join_url(request.user.username)	
	add_partcpnt = Participant()
	add_partcpnt.name = request.user.username
	add_partcpnt.meeting_id = mid
	add_partcpnt.previlage = 'moderator'
	add_partcpnt.email = request.user.email
	add_partcpnt.user_view_url = join_url
	add_partcpnt.save()
#	d = Meeting.objects.all()
#	d.delete()
	data = {}
	data['name'] = meeting_name
	data['meeting_id'] = meeting_id
	return HttpResponse(json.dumps(data))