def create_graph(self,no): cache=SiteAnalyzer.get_cache_from_db() if(no==0): return NicoTracker.create_graph(cache.day_list,cache.bbs_cnt_list) if(no==1): return NicoTracker.create_graph(cache.day_list,cache.illust_cnt_list) if(no==2): return NicoTracker.create_graph(cache.day_list,cache.entry_cnt_list) if(no==3): return NicoTracker.create_graph(cache.day_list,cache.user_cnt_list) return None
def get(self): SetUtf8.set() #ランキング更新 rank=Ranking.get_or_insert(BbsConst.THREAD_RANKING_KEY_NAME) rank.create_rank(self) ApiFeed.invalidate_cache(); #キャッシュ取得 cache=SiteAnalyzer.get_cache_from_db(); #1日単位で習得 #force=False #if(self.request.get("force")): # force=True if(cache.date and len(cache.day_list)>=1):# and not force): day1_str=NicoTracker.get_day_string(cache.date) day2_str=NicoTracker.get_day_string(datetime.datetime.today()) if(day1_str==day2_str): Alert.alert_msg_with_write(self,"ランキングを更新しました。統計情報はまだ1日が経過していないので計測していません。") return #コメント数と再生数を取得 bbs_cnt=Bbs.all().count(limit=100000) illust_cnt=MesThread.all().count(limit=100000) entry_cnt=Entry.all().count(limit=100000) user_cnt=Bookmark.all().count(limit=100000) #書き込み day_str=NicoTracker.get_day_string(datetime.datetime.today()) cache.entry_cnt_list.insert(0,entry_cnt) cache.illust_cnt_list.insert(0,illust_cnt) cache.bbs_cnt_list.insert(0,bbs_cnt) cache.user_cnt_list.insert(0,user_cnt) cache.day_list.insert(0,day_str) cache.bbs_n=bbs_cnt cache.illust_n=illust_cnt cache.put() Alert.alert_msg_with_write(self,"ランキングを更新しました。")