Browse Source

Fix error if user has no game_id

JoostSijm 6 years ago
parent
commit
cef1392c1b
2 changed files with 4 additions and 2 deletions
  1. 3 1
      app/models.py
  2. 1 1
      app/modules/vote/templates/vote/codes.j2

+ 3 - 1
app/models.py

@@ -55,7 +55,9 @@ class User(db.Model, UserMixin):
 
     def game_url(self):
         """Give profile url"""
-        return "https://rivalregions.com/#slide/profile/%d" % self.game_id
+        if self.game_id:
+            return "https://rivalregions.com/#slide/profile/%d" % self.game_id
+        return
 
 
     question_id = db.Column(

+ 1 - 1
app/modules/vote/templates/vote/codes.j2

@@ -16,7 +16,7 @@
             <tr>
                 <td>{{ user.name }}</td>
                 <td>{{ user.discord }}</td>
-                <td><a href="{{ user.game_url() }}" target="_blank">{{ user.game_id }}</a></td>
+                <td>{% if user.game_id %}<a href="{{ user.game_url() }}" target="_blank">{{ user.game_id }}</a>{% endif %}</td>
                 <td>{{ code.get_digest(user.id) }}</td>
             </tr>
             {%- endfor -%}