예제 #1
0
    print("Module : [Lect Mo:Lect Af]", "[Lab Mo: Lab Af]")
    
    for m in modules:
        mid=m[0]
        mname=m[1]
       
        
        exsql_lect_mor="and mid=" + str(mid) + " and sptype=1 and sesid < 3"
        lect_mn=count_recs(cursor,gid,semid,exsql_lect_mor)
        
        exsql_lect_aft="and mid=" + str(mid) + " and sptype=1 and sesid > 2"
        lect_af=count_recs(cursor,gid,semid, exsql_lect_aft)

        exsql_lab_mor="and mid=" + str(mid) + " and sptype=2 and sesid < 3"
        lab_mn=count_recs(cursor,gid,semid,exsql_lab_mor)
        
        exsql_lab_aft="and mid=" + str(mid) + " and sptype=2 and sesid > 2"
        lab_af=count_recs(cursor,gid,semid,exsql_lab_aft)
        s1="[" + str(lect_mn) +" : " + str(lect_af) + "]"
        s2="[" + str(lab_mn) +" : " + str(lab_af) + "]"
        print(mname, ":", s1, s2)
        
        

if __name__ == "__main__":
    delay=0.05
    conn=xdb.opendb('genetic56.db')
    cursor =conn.cursor() # create a cursor object
    semaster_stats(cursor,1,1)
    xdb.closedb(conn)
예제 #2
0
    sqls = ""
    #data : weeks, lectures, labworks for 11 fitness=n (299)
    n = 11  # safety
    mwll_arr = [(10, 1, 1), (10, 1, 1), (10, 1, 1), (10, 1, 1), (10, 1, 1),
                (10, 1, 1), (10, 1, 1), (14, 1, 1), (15, 1, 1), (15, 2, 1),
                (14, 2, 2)]

    #for a in mod_weekly_freq_nweeks:
    #	sum=sum+ a[0] * (a[1]+a[2])

    for i in range(n):
        name = "Module " + str(i + 1)

        #print(i,n,name)
        nweeks, nlect, nlab = mwll_arr[i]

        step = 1  # 1- every day, every 2nd day, every week
        sql = 'INSERT INTO fitness (name,weeks, lectures, labworks) VALUES (' + '"{}" , {}, {}, {}'.format(
            name, nweeks, nlect, nlab) + ');'
        #print (sql)
        sqls = sqls + sql

    success, count = xdb.runSQL_stmts(cursor, sqls, delay)
    return success, count


if __name__ == "__main__":
    conn = xdb.opendb('genetic4.db')
    cursor = conn.cursor()  # create a cursor object
    print(crt_fitness_table(cursor))