Esempio n. 1
0
  def rank_values(self, user_ref, acc_ref, height, width):
    rank = 0
    if user_ref:
      rank = user_ref.rank
    rank_ref = None
    if not acc_ref:
      rank_ref = Rank()
    else: 
      try:
        rank_ref = acc_ref.rankWidget
      except:
        rank_ref = widgets_dao.add_rank(acc_ref)

    # here we get the custom rank settings
    ret = {"status":"success"}
     
    for ii in rank_ref.properties():
      ret[ii] = getattr(rank_ref, ii)
    rank = calculate_rank(user_ref, acc_ref)
    if rank == constants.NOT_RANKED:
      ret['rank'] = "Unranked"
    else:
      ret['rank']= "&#35 " + format_integer(rank)
    # Internal div's need to be slighy smaller than the iframe
    if width and height:
      try:
        width = int(width)
        height = int(height)
        # How did I get this equation? Trial and error.
        height = height - 2 *int(ret['borderThickness']) - 8
        width = width - 2 *int(ret['borderThickness']) - 8
        ret['height'] = height
        ret['width'] = width
      except:
        pass
    
    return ret
Esempio n. 2
0
def get_rank_properties_to_render(email):
  return get_values("Rank", email, Rank.properties())
Esempio n. 3
0
def get_rank_properties_to_render(email):
  return get_values("Rank", email, Rank.properties())