コード例 #1
0
ファイル: functions4.py プロジェクト: itucsdb1929/itucsdb1929
def get_productions_of_city(cursor, cityname):

    productions = sourcesDict.copy()
    for sourceType in productions:
        productions[sourceType] = CRUD.get_column(cursor, "CityProductions", "cityname", cityname, sourceType)

    return productions
コード例 #2
0
ファイル: functions4.py プロジェクト: itucsdb1929/itucsdb1929
def get_city_source_limits(cursor, cityname):
    limit = sourcesDict.copy()
    for sourceType in limit:
        limit[sourceType] = CRUD.get_column(cursor, "CityLimits",
                    "cityname", cityname,
                    sourceType)
    return limit
コード例 #3
0
ファイル: functions4.py プロジェクト: itucsdb1929/itucsdb1929
def get_base_building_increment(cursor, buildingname):
    baseincrement = sourcesDict.copy()
    for sourceType in baseincrement:
        baseincrement[sourceType] = CRUD.get_column(cursor, "BuildingIncrementEffects",
                    "buildingname", buildingname,
                    sourceType)
    return baseincrement
コード例 #4
0
ファイル: functions4.py プロジェクト: itucsdb1929/itucsdb1929
def get_base_building_limits(cursor, buildingname):
    baselimits = sourcesDict.copy()
    print("baselimits", baselimits)
    for sourceType in baselimits:
        baselimits[sourceType] = CRUD.get_column(cursor, "BuildingLimitEffects",
                    "buildingname", buildingname, sourceType)
    print("returning limits", baselimits)               
    return baselimits
コード例 #5
0
ファイル: statements.py プロジェクト: itucsdb1929/itucsdb1929
def get_base_building_productions(cursor, buildingname):
    cursor.execute("""select stype, value from public.BuildingEffects
                        where buildingname=%s and etype='inc'""", (buildingname,))
    baseproductions = cursor.fetchall()
    baseproductionsDict = sourcesDict.copy()

    for (stype, value) in baseproductions:
        baseproductionsDict[stype] = value

    return baseproductionsDict
コード例 #6
0
ファイル: statements.py プロジェクト: itucsdb1929/itucsdb1929
def get_sources_of_user(cursor, username):
    cursor.execute("""select stype,value from public.sources
                        where username=%s""", (username,))

    sourcesUser = cursor.fetchall()
    sourcesD = sourcesDict.copy()



    for (stype, value) in sourcesUser:
        sourcesD[stype] += value

    return sourcesD
コード例 #7
0
ファイル: statements.py プロジェクト: itucsdb1929/itucsdb1929
def get_user_source_limits(cursor, username):
    cursor.execute("""select stype,value from public.limits
                        where username=%s""", (username,))

    limitsUser = cursor.fetchall()
    # print("limit user", limitsUser)

    limitsDict = sourcesDict.copy()

    for (stype, value) in limitsUser:
        limitsDict[stype] += value

    # print("limit return", limitsDict)
    return limitsDict
コード例 #8
0
ファイル: functions4.py プロジェクト: itucsdb1929/itucsdb1929
def update_all_city_productions(cursor):

    all_cities = get_all_cities(cursor)
    for cityname in all_cities:
        baseproductions = sourcesDict.copy()
        for sourceType in baseproductions:
            baseproductions[sourceType] = CRUD.get_column(cursor, "CityBaseProductions", "cityname", cityname, sourceType)
        
        buildings = get_buildings_of_city(cursor, cityname)

        productions = baseproductions

        for building in buildings:
            prods = get_building_productions(cursor, building)
            for prod in prods:
                productions[prod] += prods[prod]
            #endfor
        #endfor
        update_city_productions(cursor, cityname, productions)
コード例 #9
0
ファイル: statements.py プロジェクト: itucsdb1929/itucsdb1929
def get_sources_of_city(cursor, cityname):
    sources = sourcesDict.copy()
    for source in sources:
        sources[source] = CRUD.get_column(cursor, "citysources", "cityname", cityname, source)
    
    return sources