Ejemplo n.º 1
0
def get_classroom(condition):
    try:
        if condition == u"博南" or condition == u"博学南楼":
            bds = [u"博南A楼", u"博南B楼", u"博南C楼"]
            bncond = "buildingName in ('" + "','".join(bds) + "')"
        elif condition == u"博北" or condition == u"博学北楼":
            bds = [u"博北A楼", u"博北B楼", u"博北C楼", u"博北D楼"]
            bncond = "buildingName in ('" + "','".join(bds) + "')"
        elif condition == u"":
            bncond = "0 = 0"
        else:
            bncond = "buildingName = '" + condition + "'"
        qweek = common.get_week_today()
        tmplist = common.get_classindex(common.get_now_time(), common.get_next_time())
        if tmplist:
            jccondition = "courseTime in(" + ",".join(str(x) for x in tmplist) + ")"
        else:
            jccondition = "1=0"
        sqlstr = (
            "select * from classroomDB where %s and roomID not in(select roomID from scheduleDB where courseWeekday='%s' and fromWeek <= %s and endWeek >= %s and %s) limit 0,30"
            % (bncond, common.get_weekday_today(), qweek, qweek, jccondition)
        )
        qresults = db.query(sqlstr)
        retstr = ""
        for result in qresults:
            retstr = u"%s教室:%s 座位数:%s 类型:%s\n" % (retstr, result.roomName, result.seatCount, result.roomType)
    except:
        return None
    else:
        return retstr
Ejemplo n.º 2
0
def get_coursetable(roomName):
    try:
        qweek = common.get_week_today()
        sqlstr = (
            "select scheduleDB.courseTime,scheduleDB.courseID,courseDB.courseName,scheduleDB.teacherID,teacherDB.teacherName,scheduleDB.courseDept,scheduleDB.fromWeek,scheduleDB.endWeek from scheduleDB inner join courseDB inner join teacherDB inner join classroomDB on classroomDB.roomName = '%s' and classroomDB.roomID=scheduleDB.roomID and fromWeek<=%s and endWeek>=%s and courseWeekday='%s' and scheduleDB.courseID=courseDB.courseID and scheduleDB.teacherID=teacherDB.teacherID order by courseTime asc limit 0,11"
            % (roomName, qweek, qweek, common.get_weekday_today())
        )
        qresults = db.query(sqlstr)
        retstr = ""
        for result in qresults:
            retstr = u"%s第%s节:%s 教师:%s 班级:%s 起讫周:%s-%s\n" % (
                retstr,
                result.courseTime,
                result.courseName,
                result.teacherName,
                result.courseDept if result.courseDept else "--",
                result.fromWeek,
                result.endWeek,
            )
    except:
        return None
    else:
        return retstr[0:-2]
Ejemplo n.º 3
0
def get_classroom(condition):
    try:
        if condition == u"博南" or condition == u"博学南楼":
            bds = [u'博南A楼',u'博南B楼',u'博南C楼']
            bncond = "buildingName in ('"+"','".join(bds)+"')"
        elif condition == u"博北" or condition == u"博学北楼":
            bds = [u'博北A楼',u'博北B楼',u'博北C楼',u'博北D楼']
            bncond = "buildingName in ('"+"','".join(bds)+"')"
        elif condition == u"":
            bncond = "0 = 0"
        else:
             bncond = "buildingName = '" + condition + "'"
        qweek = common.get_week_today()
        tmplist=common.get_classindex(common.get_now_time(),common.get_next_time())
        if tmplist:
            jccondition="courseTime in("+",".join(str(x) for x in tmplist)+")"
        else:
            jccondition="1=0"
        sqlstr="select * from classroomDB where %s and roomID not in(select roomID from scheduleDB where courseWeekday='%s' and fromWeek <= %s and endWeek >= %s and %s) limit 0,30"%(bncond,common.get_weekday_today(),qweek,qweek,jccondition)
        qresults = db.query(sqlstr)
        retstr = ""
        for result in qresults:
            retstr = u"%s教室:%s 座位数:%s 类型:%s\n"%(retstr,result.roomName,result.seatCount,result.roomType)
    except:
        return None
    else:
        return retstr
Ejemplo n.º 4
0
def get_coursetable(roomName):
    try:
        qweek = common.get_week_today()
        sqlstr = "select scheduleDB.courseTime,scheduleDB.courseID,courseDB.courseName,scheduleDB.teacherID,teacherDB.teacherName,scheduleDB.courseDept,scheduleDB.fromWeek,scheduleDB.endWeek from scheduleDB inner join courseDB inner join teacherDB inner join classroomDB on classroomDB.roomName = '%s' and classroomDB.roomID=scheduleDB.roomID and fromWeek<=%s and endWeek>=%s and courseWeekday='%s' and scheduleDB.courseID=courseDB.courseID and scheduleDB.teacherID=teacherDB.teacherID order by courseTime asc limit 0,11"%(roomName,qweek,qweek,common.get_weekday_today())
        qresults = db.query(sqlstr)
        retstr = ""
        for result in qresults:
            retstr = u"%s第%s节:%s 教师:%s 班级:%s 起讫周:%s-%s\n"%(retstr,result.courseTime,result.courseName,result.teacherName,result.courseDept if result.courseDept else "--",result.fromWeek,result.endWeek)
    except:
        return None
    else:
        return retstr[0:-2]