prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Users in admin scoreboard show user position instead of team position
  In teams mode on the admin panel, users are shown with their user position on the scoreboard instead of their teams position. We should be showing both. 
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `CTFd/admin/users.py`
  Content:
  ```
  1 from flask import render_template, request, url_for
  2 from sqlalchemy.sql import not_
  3 
  4 from CTFd.admin import admin
  5 from CTFd.models import Challenges, Tracking, Users
  6 from CTFd.utils import get_config
  7 from CTFd.utils.decorators import admins_only
  8 from CTFd.utils.modes import TEAMS_MODE
  9 
  10 
  11 @admin.route("/admin/users")
  12 @admins_only
  13 def users_listing():
  14     q = request.args.get("q")
  15     field = request.args.get("field")
  16     page = abs(request.args.get("page", 1, type=int))
  17     filters = []
  18     users = []
  19 
  20     if q:
  21         # The field exists as an exposed column
  22         if Users.__mapper__.has_property(field):
  23             filters.append(getattr(Users, field).like("%{}%".format(q)))
  24 
  25     if q and field == "ip":
  26         users = (
  27             Users.query.join(Tracking, Users.id == Tracking.user_id)
  28             .filter(Tracking.ip.like("%{}%".format(q)))
  29             .order_by(Users.id.asc())
  30             .paginate(page=page, per_page=50)
  31         )
  32     else:
  33         users = (
  34             Users.query.filter(*filters)
  35             .order_by(Users.id.asc())
  36             .paginate(page=page, per_page=50)
  37         )
  38 
  39     args = dict(request.args)
  40     args.pop("page", 1)
  41 
  42     return render_template(
  43         "admin/users/users.html",
  44         users=users,
  45         prev_page=url_for(request.endpoint, page=users.prev_num, **args),
  46         next_page=url_for(request.endpoint, page=users.next_num, **args),
  47         q=q,
  48         field=field,
  49     )
  50 
  51 
  52 @admin.route("/admin/users/new")
  53 @admins_only
  54 def users_new():
  55     return render_template("admin/users/new.html")
  56 
  57 
  58 @admin.route("/admin/users/<int:user_id>")
  59 @admins_only
  60 def users_detail(user_id):
  61     # Get user object
  62     user = Users.query.filter_by(id=user_id).first_or_404()
  63 
  64     # Get the user's solves
  65     solves = user.get_solves(admin=True)
  66 
  67     # Get challenges that the user is missing
  68     if get_config("user_mode") == TEAMS_MODE:
  69         if user.team:
  70             all_solves = user.team.get_solves(admin=True)
  71         else:
  72             all_solves = user.get_solves(admin=True)
  73     else:
  74         all_solves = user.get_solves(admin=True)
  75 
  76     solve_ids = [s.challenge_id for s in all_solves]
  77     missing = Challenges.query.filter(not_(Challenges.id.in_(solve_ids))).all()
  78 
  79     # Get IP addresses that the User has used
  80     addrs = (
  81         Tracking.query.filter_by(user_id=user_id).order_by(Tracking.date.desc()).all()
  82     )
  83 
  84     # Get Fails
  85     fails = user.get_fails(admin=True)
  86 
  87     # Get Awards
  88     awards = user.get_awards(admin=True)
  89 
  90     # Get user properties
  91     score = user.get_score(admin=True)
  92     place = user.get_place(admin=True)
  93 
  94     return render_template(
  95         "admin/users/user.html",
  96         solves=solves,
  97         user=user,
  98         addrs=addrs,
  99         score=score,
  100         missing=missing,
  101         place=place,
  102         fails=fails,
  103         awards=awards,
  104     )
  105
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/CTFd/admin/users.py b/CTFd/admin/users.py
  --- a/CTFd/admin/users.py
  +++ b/CTFd/admin/users.py
  @@ -88,8 +88,8 @@
       awards = user.get_awards(admin=True)
   
       # Get user properties
  -    score = user.get_score(admin=True)
  -    place = user.get_place(admin=True)
  +    score = user.account.get_score(admin=True)
  +    place = user.account.get_place(admin=True)
   
       return render_template(
           "admin/users/user.html",
  
verification_info: {"golden_diff": "diff --git a/CTFd/admin/users.py b/CTFd/admin/users.py\n--- a/CTFd/admin/users.py\n+++ b/CTFd/admin/users.py\n@@ -88,8 +88,8 @@\n     awards = user.get_awards(admin=True)\n \n     # Get user properties\n-    score = user.get_score(admin=True)\n-    place = user.get_place(admin=True)\n+    score = user.account.get_score(admin=True)\n+    place = user.account.get_place(admin=True)\n \n     return render_template(\n         \"admin/users/user.html\",\n", "issue": "Users in admin scoreboard show user position instead of team position\nIn teams mode on the admin panel, users are shown with their user position on the scoreboard instead of their teams position. We should be showing both. \n", "before_files": [{"content": "from flask import render_template, request, url_for\nfrom sqlalchemy.sql import not_\n\nfrom CTFd.admin import admin\nfrom CTFd.models import Challenges, Tracking, Users\nfrom CTFd.utils import get_config\nfrom CTFd.utils.decorators import admins_only\nfrom CTFd.utils.modes import TEAMS_MODE\n\n\n@admin.route(\"/admin/users\")\n@admins_only\ndef users_listing():\n    q = request.args.get(\"q\")\n    field = request.args.get(\"field\")\n    page = abs(request.args.get(\"page\", 1, type=int))\n    filters = []\n    users = []\n\n    if q:\n        # The field exists as an exposed column\n        if Users.__mapper__.has_property(field):\n            filters.append(getattr(Users, field).like(\"%{}%\".format(q)))\n\n    if q and field == \"ip\":\n        users = (\n            Users.query.join(Tracking, Users.id == Tracking.user_id)\n            .filter(Tracking.ip.like(\"%{}%\".format(q)))\n            .order_by(Users.id.asc())\n            .paginate(page=page, per_page=50)\n        )\n    else:\n        users = (\n            Users.query.filter(*filters)\n            .order_by(Users.id.asc())\n            .paginate(page=page, per_page=50)\n        )\n\n    args = dict(request.args)\n    args.pop(\"page\", 1)\n\n    return render_template(\n        \"admin/users/users.html\",\n        users=users,\n        prev_page=url_for(request.endpoint, page=users.prev_num, **args),\n        next_page=url_for(request.endpoint, page=users.next_num, **args),\n        q=q,\n        field=field,\n    )\n\n\n@admin.route(\"/admin/users/new\")\n@admins_only\ndef users_new():\n    return render_template(\"admin/users/new.html\")\n\n\n@admin.route(\"/admin/users/<int:user_id>\")\n@admins_only\ndef users_detail(user_id):\n    # Get user object\n    user = Users.query.filter_by(id=user_id).first_or_404()\n\n    # Get the user's solves\n    solves = user.get_solves(admin=True)\n\n    # Get challenges that the user is missing\n    if get_config(\"user_mode\") == TEAMS_MODE:\n        if user.team:\n            all_solves = user.team.get_solves(admin=True)\n        else:\n            all_solves = user.get_solves(admin=True)\n    else:\n        all_solves = user.get_solves(admin=True)\n\n    solve_ids = [s.challenge_id for s in all_solves]\n    missing = Challenges.query.filter(not_(Challenges.id.in_(solve_ids))).all()\n\n    # Get IP addresses that the User has used\n    addrs = (\n        Tracking.query.filter_by(user_id=user_id).order_by(Tracking.date.desc()).all()\n    )\n\n    # Get Fails\n    fails = user.get_fails(admin=True)\n\n    # Get Awards\n    awards = user.get_awards(admin=True)\n\n    # Get user properties\n    score = user.get_score(admin=True)\n    place = user.get_place(admin=True)\n\n    return render_template(\n        \"admin/users/user.html\",\n        solves=solves,\n        user=user,\n        addrs=addrs,\n        score=score,\n        missing=missing,\n        place=place,\n        fails=fails,\n        awards=awards,\n    )\n", "path": "CTFd/admin/users.py"}], "after_files": [{"content": "from flask import render_template, request, url_for\nfrom sqlalchemy.sql import not_\n\nfrom CTFd.admin import admin\nfrom CTFd.models import Challenges, Tracking, Users\nfrom CTFd.utils import get_config\nfrom CTFd.utils.decorators import admins_only\nfrom CTFd.utils.modes import TEAMS_MODE\n\n\n@admin.route(\"/admin/users\")\n@admins_only\ndef users_listing():\n    q = request.args.get(\"q\")\n    field = request.args.get(\"field\")\n    page = abs(request.args.get(\"page\", 1, type=int))\n    filters = []\n    users = []\n\n    if q:\n        # The field exists as an exposed column\n        if Users.__mapper__.has_property(field):\n            filters.append(getattr(Users, field).like(\"%{}%\".format(q)))\n\n    if q and field == \"ip\":\n        users = (\n            Users.query.join(Tracking, Users.id == Tracking.user_id)\n            .filter(Tracking.ip.like(\"%{}%\".format(q)))\n            .order_by(Users.id.asc())\n            .paginate(page=page, per_page=50)\n        )\n    else:\n        users = (\n            Users.query.filter(*filters)\n            .order_by(Users.id.asc())\n            .paginate(page=page, per_page=50)\n        )\n\n    args = dict(request.args)\n    args.pop(\"page\", 1)\n\n    return render_template(\n        \"admin/users/users.html\",\n        users=users,\n        prev_page=url_for(request.endpoint, page=users.prev_num, **args),\n        next_page=url_for(request.endpoint, page=users.next_num, **args),\n        q=q,\n        field=field,\n    )\n\n\n@admin.route(\"/admin/users/new\")\n@admins_only\ndef users_new():\n    return render_template(\"admin/users/new.html\")\n\n\n@admin.route(\"/admin/users/<int:user_id>\")\n@admins_only\ndef users_detail(user_id):\n    # Get user object\n    user = Users.query.filter_by(id=user_id).first_or_404()\n\n    # Get the user's solves\n    solves = user.get_solves(admin=True)\n\n    # Get challenges that the user is missing\n    if get_config(\"user_mode\") == TEAMS_MODE:\n        if user.team:\n            all_solves = user.team.get_solves(admin=True)\n        else:\n            all_solves = user.get_solves(admin=True)\n    else:\n        all_solves = user.get_solves(admin=True)\n\n    solve_ids = [s.challenge_id for s in all_solves]\n    missing = Challenges.query.filter(not_(Challenges.id.in_(solve_ids))).all()\n\n    # Get IP addresses that the User has used\n    addrs = (\n        Tracking.query.filter_by(user_id=user_id).order_by(Tracking.date.desc()).all()\n    )\n\n    # Get Fails\n    fails = user.get_fails(admin=True)\n\n    # Get Awards\n    awards = user.get_awards(admin=True)\n\n    # Get user properties\n    score = user.account.get_score(admin=True)\n    place = user.account.get_place(admin=True)\n\n    return render_template(\n        \"admin/users/user.html\",\n        solves=solves,\n        user=user,\n        addrs=addrs,\n        score=score,\n        missing=missing,\n        place=place,\n        fails=fails,\n        awards=awards,\n    )\n", "path": "CTFd/admin/users.py"}]}