Example #1
0
	def generate(self, table, iter=1):
		if not table:
			return
		
		HEADER, VALUE, FORMAT = range(3)
		
		if type(table[0]) != type([]):
			table = [table]
		
		rows = [[ i[HEADER] for i in table[0] ]]
		for row in table:
			cols = []
			for col in row:
				col = list(col)
				if len(col) > 2:
					if col[FORMAT] == DATE:
						col[VALUE] = self.fmt_date(col[VALUE])
					elif col[FORMAT] == SDATE:
						col[VALUE] = self.fmt_str_date(col[VALUE])
					elif col[FORMAT] == TIME:
						col[VALUE] = self.fmt_time(col[VALUE])
					elif col[FORMAT] == TIME:
						col[VALUE] = self.fmt_time(col[VALUE])
					elif col[FORMAT] == AMOUNT:
						col[VALUE] = self.fmt_amount(col[VALUE])
				cols.append(col[VALUE])
			rows.append(cols)
		
		return self.name, html_table.table(rows)
Example #2
0
        summary[app].setdefault("num", 0)
        summary[app].setdefault("uu", 0)
        summary[app]["num"] += title
        summary[app]["uu"] += 1

print "#############サマリデータ取得################"
print summary

label = ["アプリ名", "アプリID", "UU", "起動回数", "平均起動回数"]
d = []
for k, v in sorted(summary.items(), key=lambda x: x[1]["uu"], reverse=True):
    k2 = google_play.google_play_title(k)
    rec = [str(k2), str(k), str(v["uu"]), str(v["num"]), str(round(float(v["num"]) / float(v["uu"]), 1))]
    d.append(rec)

table = html_table.table(label, d)


print "#############アプリテーブルデータ取得################"
print table

summary = {}
uu, leave = 0, 0
for uid, apps in user_data.items():
    uu += 1
    if len(apps["install"]) == 0:
        leave += 1
    for app, title in apps["install"].items():
        print app, title
        summary.setdefault(app, {})
        summary[app].setdefault("num", 0)
Example #3
0
            star = float(int(float(v["star"]) * 10)) / 10
            water = float(int(float(v["water"]) * 10)) / 10
            t = int(float(v["time"]))
            rec = [l + s + d, c, str(num), str(uu), str(water), str(star), str(t)]
            data.append(rec)

sorted(data, key = lambda x:(x[0], x[1]))

label = ["ステージ", "車種", "プレイ回数", "プレイ人数", "平均水量", "平均星数", "平均消化時間"]
#d = []
#for k, v in sorted(summary.items(), key = lambda x:x[1]["uu"], reverse=True):
#    k2 = google_play.google_play_title(k)
#    rec = [str(k2), str(k), str(v["uu"]), str(v["num"]), str(round(float(v["num"]) / float(v["uu"]), 1))]
#    d.append(rec)

table = html_table.table(label, data)

content = "<div> プレイ詳細 </div><br>" + table



db = {
    "smartapps"   : { "server" : "apps.db.smartsrv.jp",
                      "db_name" : "smartapps_user",
                      "table" : ["Users_0", "Users_1", "Users_2", "Users_3", "Users_4",
                                  "Users_5", "Users_6", "Users_7", "Users_8", "Users_9",],
                      "colum" : "user_id, date(created) as created"
                      },
    
    }
data = {}