def get(self): if os.path.exists(DIR+'content.md'): with open(DIR+'content.md') as f: self.content = f.read() self.score['meng'] = 0 self.score['flower'] = 0 if os.path.exists(DIR+'score.db'): with open(DIR+'score.db') as f: score_list = f.read().splitlines() key = ['name', 'content', 'datetime', 'score'] value = [] for s in score_list: value.append(s.split('/')) score_detail = return_dict(key, value) for score in score_detail: name = score['name'] _score = score['score'] if name == 'meng': self.score['meng'] += int(_score) else: self.score['flower'] += int(_score) return render('score/index.html', content=self.content, score=self.score)
def get(self): if os.path.exists(DIR+'score.db'): with open(DIR+'score.db') as f: score_list = f.read().splitlines() else: score_list = '' key = ['name', 'content', 'datetime', 'score'] value = [] for s in score_list: value.append(s.split('/')) score_detail = return_dict(key, value) return render('score/detail.html', score_detail=score_detail)