def normalGame(setId, gameType): studyset = models.getSetById(setId) if not studyset: return "404 set not found" #terms,defs,termtypes,deftypes = models.getSetData(studyset) terms = models.getStudyData(studyset) # TODO: ESCAPE QUOTES # defs=defs,termtypes=termtypes,deftypes=deftypes return render_template('playnormal.html',set=studyset,terms=terms, setId=setId,type=gameType,isEditable=True)
def viewStats(setId=None): ''' View stats for a given set. ''' theset = models.getSetById(setId) terms = [] if theset.settype == "tag": terms = models.getImageTags(setId) else: terms = models.getStudyData(theset) stats = [] for term in terms: overallPercent, num = models.getStatsFor(theset, term) stats.append([term, int(round(overallPercent)), overallPercent*6, num]) mean, distr = models.getOverallStats(theset) return render_template('stats.html', stats=stats,theset=theset, mean=int(round(mean)), distr=distr)
def reviewSet(reviewid=None): studyset = models.getSetById(reviewid) if not studyset: return "404 set not found" #terms,defs,termtypes,deftypes = models.getSetData(studyset) terms = models.getStudyData(studyset) isCreator = False isFav = False if g.userId != None: creator = models.getCreator(reviewid).username isCreator = creator.lower() == g.userId.lower() isFav = models.favExists(g.userId.lower(), reviewid) # TODO: ESCAPE QUOTES # ,defs=defs,termtypes=termtypes, deftypes=deftypes, return render_template('reviewset.html',settitle=studyset.title, private=studyset.isprivate,terms=terms, setId=reviewid, isEditable=True, isCreator=isCreator,isFavable=True,isFav=isFav)