Example #1
0
 def set_organization_and_get_organization_list(self, requestdata, userid):
     organization_list, organization_name = [], ''
     organizationmysqldataset = model.get_user_organizations(userid)
     if organizationmysqldataset:
         for row in organizationmysqldataset:
             organization_list.append([row["orgid"],row["organizationname"]])   
     if hasattr(requestdata, 'orgid'):
         organization_id = requestdata.orgid
         model.set_last_used_organization_as_admin(userid, organization_id)
     else:
         lastusedorgasadmin = model.get_last_used_organization_as_admin(userid)
         organization_id = lastusedorgasadmin 
         if lastusedorgasadmin == 0:
             if organization_list: 
                 organization_id = organization_list[0][0]
         
     if organization_list: organization_name = model.get_organization_name(organization_id)     
     return organization_id, organization_list, organization_name
Example #2
0
 def GET(self):
     requestdata = web.input()
     organizationlist = []
     teamlist = []
     organizationmysqldataset = model.get_user_organizations(session.userid)
     if organizationmysqldataset:
         for row in organizationmysqldataset:
             organizationlist.append([row["orgid"],row["organizationname"]])
     if requestdata.orgid:
         orgid = requestdata.orgid
         orgname = model.get_organization_name(orgid)
         myteams = model.get_teams_and_score_for_organization(orgid)
         if myteams:
             for row in myteams:
                 if str(row["score"]) == "None":
                     team_score = 0
                 else:
                     team_score = row["score"] 
                 teamlist.append([row["teamid"],row["teamname"], team_score])
         return render.scoreboard(teamlist)
     else:
         return render.scoreboard(teamlist)
Example #3
0
 def GET(self):
     organizationmysqldataset = model.get_user_organizations(session.userid)
     if organizationmysqldataset:
         raise web.seeother('/')
     else:
         return render.indexwithoutactiveorganization()