当前位置: 首页>>代码示例>>Python>>正文


Python Conference.maxcapacity方法代码示例

本文整理汇总了Python中models.Conference.maxcapacity方法的典型用法代码示例。如果您正苦于以下问题:Python Conference.maxcapacity方法的具体用法?Python Conference.maxcapacity怎么用?Python Conference.maxcapacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Conference的用法示例。


在下文中一共展示了Conference.maxcapacity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: match_or_send_to_waiting_room

# 需要导入模块: from models import Conference [as 别名]
# 或者: from models.Conference import maxcapacity [as 别名]
def match_or_send_to_waiting_room(call, schedule):

    # Refreshing database object
    flush_transaction()
    call.reload()

    if call.matched:
        other = call.conference.call_set.exclude(pk=call.pk)[0]
        data = send_to_conference_room(call, schedule, other, initial=False)

        if data: return data


    matchcall = find_match(schedule, call)
    if matchcall:
        conf = Conference()
        conf.maxcapacity = 2
        conf.datecreated = as_date(schedule)
        conf.save()

        call.conference = conf
        call.matched = True
        call.save()

        matchcall.conference = conf
        matchcall.matched = True
        matchcall.save()

        data = send_to_conference_room(call, schedule, matchcall, initial=True)
        if data: return data

    if call.user.profile.any_match:
        call.user.profile.any_match = False
        call.user.profile.save()

        return render_to_response("twilioresponse.xml", { 'say' :"We are very sorry - We could not find you a match today, but tomorrow we'll do our best to compensate it! We wish you an awesome day!",
                                                          'hangup' : True })
    #Check if we have exceeded the waiting redirect limits
    elif call.retries >= REDIRECT_LIMIT:
        # The user has reached the limit of redials, so hang up
        logger.debug("LIMIT RETRIES - Ask to try to match with any person")
        any_match = "We could not find any matches. If you'd like us to try to match you with Anyone please press any number now."
        goodbye = "We wish you an Amazing day! Good bye!"
        return render_to_response("twilioresponse.xml", { 'any_match' :any_match, 'schedule': schedule, 'hangup': True, 'goodbye' : goodbye })

    call.retries = call.retries + 1
    call.save()

    # Send user to private conference (Conferencename=Username) or send them to the waiting room they were at
    return send_to_waiting_room(  HOLD_LIMIT
                                    , schedule
                                    , call.user.username
                                    , False
                                    , "Please bare with us - we'll find the best match for you!")
开发者ID:axsauze,项目名称:wakeuproulette,代码行数:56,代码来源:views.py

示例2: get_active_waiting_room

# 需要导入模块: from models import Conference [as 别名]
# 或者: from models.Conference import maxcapacity [as 别名]
def get_active_waiting_room(schedule):
    dateSchedule = as_date(schedule)
    # Refreshing database
    flush_transaction()
    try:
        allWaitingRooms = Conference.objects.filter(datecreated=dateSchedule, maxcapacity=WAITING_ROOM_MAX)
        logger.debug("All waiting rooms: " + str(allWaitingRooms))

        # Find free waiting room
        for waiting in allWaitingRooms:
            if waiting.available():
                logger.debug("Waiting room chosen: " + str(waiting.pk))
                return waiting

    # No free waiting rooms so create one
    except Conference.DoesNotExist:
        pass # None found, so create one

    waiting = Conference()
    waiting.datecreated = dateSchedule
    waiting.maxcapacity = WAITING_ROOM_MAX
    waiting.save()
    return waiting
开发者ID:axsauze,项目名称:wakeuproulette,代码行数:25,代码来源:views.py


注:本文中的models.Conference.maxcapacity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。