We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Feature Request : Search users by IP address
It's really hard to search an IP address on the UI now.

It'd be nice to have a search feature in `admin/users` search a user by an IP address. CTFd already logs IP addresses of each login so it'll be very useful when wanting to ban certain users for abusing rules.


--- 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
2 from CTFd.utils import get_config
3 from CTFd.utils.decorators import admins_only
4 from CTFd.utils.modes import TEAMS_MODE
5 from CTFd.models import db, Users, Challenges, Tracking
6 from CTFd.admin import admin
7 from CTFd.utils.helpers import get_errors
8 
9 from sqlalchemy.sql import not_
10 
11 
12 @admin.route("/admin/users")
13 @admins_only
14 def users_listing():
15     page = abs(request.args.get("page", 1, type=int))
16     q = request.args.get("q")
17     if q:
18         field = request.args.get("field")
19         users = []
20         errors = get_errors()
21         if field == "id":
22             if q.isnumeric():
23                 users = Users.query.filter(Users.id == q).order_by(Users.id.asc()).all()
24             else:
25                 users = []
26                 errors.append("Your ID search term is not numeric")
27         elif field == "name":
28             users = (
29                 Users.query.filter(Users.name.like("%{}%".format(q)))
30                 .order_by(Users.id.asc())
31                 .all()
32             )
33         elif field == "email":
34             users = (
35                 Users.query.filter(Users.email.like("%{}%".format(q)))
36                 .order_by(Users.id.asc())
37                 .all()
38             )
39         elif field == "affiliation":
40             users = (
41                 Users.query.filter(Users.affiliation.like("%{}%".format(q)))
42                 .order_by(Users.id.asc())
43                 .all()
44             )
45         return render_template(
46             "admin/users/users.html",
47             users=users,
48             pages=None,
49             curr_page=None,
50             q=q,
51             field=field,
52         )
53 
54     page = abs(int(page))
55     results_per_page = 50
56     page_start = results_per_page * (page - 1)
57     page_end = results_per_page * (page - 1) + results_per_page
58 
59     users = Users.query.order_by(Users.id.asc()).slice(page_start, page_end).all()
60     count = db.session.query(db.func.count(Users.id)).first()[0]
61     pages = int(count / results_per_page) + (count % results_per_page > 0)
62 
63     return render_template(
64         "admin/users/users.html", users=users, pages=pages, curr_page=page
65     )
66 
67 
68 @admin.route("/admin/users/new")
69 @admins_only
70 def users_new():
71     return render_template("admin/users/new.html")
72 
73 
74 @admin.route("/admin/users/<int:user_id>")
75 @admins_only
76 def users_detail(user_id):
77     # Get user object
78     user = Users.query.filter_by(id=user_id).first_or_404()
79 
80     # Get the user's solves
81     solves = user.get_solves(admin=True)
82 
83     # Get challenges that the user is missing
84     if get_config("user_mode") == TEAMS_MODE:
85         if user.team:
86             all_solves = user.team.get_solves(admin=True)
87         else:
88             all_solves = user.get_solves(admin=True)
89     else:
90         all_solves = user.get_solves(admin=True)
91 
92     solve_ids = [s.challenge_id for s in all_solves]
93     missing = Challenges.query.filter(not_(Challenges.id.in_(solve_ids))).all()
94 
95     # Get IP addresses that the User has used
96     addrs = (
97         Tracking.query.filter_by(user_id=user_id).order_by(Tracking.date.desc()).all()
98     )
99 
100     # Get Fails
101     fails = user.get_fails(admin=True)
102 
103     # Get Awards
104     awards = user.get_awards(admin=True)
105 
106     # Get user properties
107     score = user.get_score(admin=True)
108     place = user.get_place(admin=True)
109 
110     return render_template(
111         "admin/users/user.html",
112         solves=solves,
113         user=user,
114         addrs=addrs,
115         score=score,
116         missing=missing,
117         place=place,
118         fails=fails,
119         awards=awards,
120     )
121
```

Path: `CTFd/admin/teams.py`
Content:
```
1 from flask import render_template, request
2 from CTFd.utils.decorators import admins_only
3 from CTFd.models import db, Teams, Challenges, Tracking
4 from CTFd.admin import admin
5 from CTFd.utils.helpers import get_errors
6 
7 from sqlalchemy.sql import not_
8 
9 
10 @admin.route("/admin/teams")
11 @admins_only
12 def teams_listing():
13     page = abs(request.args.get("page", 1, type=int))
14     q = request.args.get("q")
15     if q:
16         field = request.args.get("field")
17         teams = []
18         errors = get_errors()
19         if field == "id":
20             if q.isnumeric():
21                 teams = Teams.query.filter(Teams.id == q).order_by(Teams.id.asc()).all()
22             else:
23                 teams = []
24                 errors.append("Your ID search term is not numeric")
25         elif field == "name":
26             teams = (
27                 Teams.query.filter(Teams.name.like("%{}%".format(q)))
28                 .order_by(Teams.id.asc())
29                 .all()
30             )
31         elif field == "email":
32             teams = (
33                 Teams.query.filter(Teams.email.like("%{}%".format(q)))
34                 .order_by(Teams.id.asc())
35                 .all()
36             )
37         elif field == "affiliation":
38             teams = (
39                 Teams.query.filter(Teams.affiliation.like("%{}%".format(q)))
40                 .order_by(Teams.id.asc())
41                 .all()
42             )
43         return render_template(
44             "admin/teams/teams.html",
45             teams=teams,
46             pages=None,
47             curr_page=None,
48             q=q,
49             field=field,
50         )
51 
52     page = abs(int(page))
53     results_per_page = 50
54     page_start = results_per_page * (page - 1)
55     page_end = results_per_page * (page - 1) + results_per_page
56 
57     teams = Teams.query.order_by(Teams.id.asc()).slice(page_start, page_end).all()
58     count = db.session.query(db.func.count(Teams.id)).first()[0]
59     pages = int(count / results_per_page) + (count % results_per_page > 0)
60     return render_template(
61         "admin/teams/teams.html", teams=teams, pages=pages, curr_page=page
62     )
63 
64 
65 @admin.route("/admin/teams/new")
66 @admins_only
67 def teams_new():
68     return render_template("admin/teams/new.html")
69 
70 
71 @admin.route("/admin/teams/<int:team_id>")
72 @admins_only
73 def teams_detail(team_id):
74     team = Teams.query.filter_by(id=team_id).first_or_404()
75 
76     # Get members
77     members = team.members
78     member_ids = [member.id for member in members]
79 
80     # Get Solves for all members
81     solves = team.get_solves(admin=True)
82     fails = team.get_fails(admin=True)
83     awards = team.get_awards(admin=True)
84     score = team.get_score(admin=True)
85     place = team.get_place(admin=True)
86 
87     # Get missing Challenges for all members
88     # TODO: How do you mark a missing challenge for a team?
89     solve_ids = [s.challenge_id for s in solves]
90     missing = Challenges.query.filter(not_(Challenges.id.in_(solve_ids))).all()
91 
92     # Get addresses for all members
93     addrs = (
94         Tracking.query.filter(Tracking.user_id.in_(member_ids))
95         .order_by(Tracking.date.desc())
96         .all()
97     )
98 
99     return render_template(
100         "admin/teams/team.html",
101         team=team,
102         members=members,
103         score=score,
104         place=place,
105         solves=solves,
106         fails=fails,
107         missing=missing,
108         awards=awards,
109         addrs=addrs,
110     )
111
```
--- 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()

```

diff --git a/CTFd/admin/teams.py b/CTFd/admin/teams.py
--- a/CTFd/admin/teams.py
+++ b/CTFd/admin/teams.py
@@ -43,7 +43,7 @@
         return render_template(
             "admin/teams/teams.html",
             teams=teams,
-            pages=None,
+            pages=0,
             curr_page=None,
             q=q,
             field=field,
diff --git a/CTFd/admin/users.py b/CTFd/admin/users.py
--- a/CTFd/admin/users.py
+++ b/CTFd/admin/users.py
@@ -42,10 +42,18 @@
                 .order_by(Users.id.asc())
                 .all()
             )
+        elif field == "ip":
+            users = (
+                Users.query.join(Tracking, Users.id == Tracking.user_id)
+                .filter(Tracking.ip.like("%{}%".format(q)))
+                .order_by(Users.id.asc())
+                .all()
+            )
+
         return render_template(
             "admin/users/users.html",
             users=users,
-            pages=None,
+            pages=0,
             curr_page=None,
             q=q,
             field=field,

{"golden_diff": "diff --git a/CTFd/admin/teams.py b/CTFd/admin/teams.py\n--- a/CTFd/admin/teams.py\n+++ b/CTFd/admin/teams.py\n@@ -43,7 +43,7 @@\n         return render_template(\n             \"admin/teams/teams.html\",\n             teams=teams,\n-            pages=None,\n+            pages=0,\n             curr_page=None,\n             q=q,\n             field=field,\ndiff --git a/CTFd/admin/users.py b/CTFd/admin/users.py\n--- a/CTFd/admin/users.py\n+++ b/CTFd/admin/users.py\n@@ -42,10 +42,18 @@\n                 .order_by(Users.id.asc())\n                 .all()\n             )\n+        elif 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+                .all()\n+            )\n+\n         return render_template(\n             \"admin/users/users.html\",\n             users=users,\n-            pages=None,\n+            pages=0,\n             curr_page=None,\n             q=q,\n             field=field,\n", "issue": "Feature Request : Search users by IP address\nIt's really hard to search an IP address on the UI now.\r\n\r\nIt'd be nice to have a search feature in `admin/users` search a user by an IP address. CTFd already logs IP addresses of each login so it'll be very useful when wanting to ban certain users for abusing rules.\r\n\n", "before_files": [{"content": "from flask import render_template, request\nfrom CTFd.utils import get_config\nfrom CTFd.utils.decorators import admins_only\nfrom CTFd.utils.modes import TEAMS_MODE\nfrom CTFd.models import db, Users, Challenges, Tracking\nfrom CTFd.admin import admin\nfrom CTFd.utils.helpers import get_errors\n\nfrom sqlalchemy.sql import not_\n\n\n@admin.route(\"/admin/users\")\n@admins_only\ndef users_listing():\n    page = abs(request.args.get(\"page\", 1, type=int))\n    q = request.args.get(\"q\")\n    if q:\n        field = request.args.get(\"field\")\n        users = []\n        errors = get_errors()\n        if field == \"id\":\n            if q.isnumeric():\n                users = Users.query.filter(Users.id == q).order_by(Users.id.asc()).all()\n            else:\n                users = []\n                errors.append(\"Your ID search term is not numeric\")\n        elif field == \"name\":\n            users = (\n                Users.query.filter(Users.name.like(\"%{}%\".format(q)))\n                .order_by(Users.id.asc())\n                .all()\n            )\n        elif field == \"email\":\n            users = (\n                Users.query.filter(Users.email.like(\"%{}%\".format(q)))\n                .order_by(Users.id.asc())\n                .all()\n            )\n        elif field == \"affiliation\":\n            users = (\n                Users.query.filter(Users.affiliation.like(\"%{}%\".format(q)))\n                .order_by(Users.id.asc())\n                .all()\n            )\n        return render_template(\n            \"admin/users/users.html\",\n            users=users,\n            pages=None,\n            curr_page=None,\n            q=q,\n            field=field,\n        )\n\n    page = abs(int(page))\n    results_per_page = 50\n    page_start = results_per_page * (page - 1)\n    page_end = results_per_page * (page - 1) + results_per_page\n\n    users = Users.query.order_by(Users.id.asc()).slice(page_start, page_end).all()\n    count = db.session.query(db.func.count(Users.id)).first()[0]\n    pages = int(count / results_per_page) + (count % results_per_page > 0)\n\n    return render_template(\n        \"admin/users/users.html\", users=users, pages=pages, curr_page=page\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"}, {"content": "from flask import render_template, request\nfrom CTFd.utils.decorators import admins_only\nfrom CTFd.models import db, Teams, Challenges, Tracking\nfrom CTFd.admin import admin\nfrom CTFd.utils.helpers import get_errors\n\nfrom sqlalchemy.sql import not_\n\n\n@admin.route(\"/admin/teams\")\n@admins_only\ndef teams_listing():\n    page = abs(request.args.get(\"page\", 1, type=int))\n    q = request.args.get(\"q\")\n    if q:\n        field = request.args.get(\"field\")\n        teams = []\n        errors = get_errors()\n        if field == \"id\":\n            if q.isnumeric():\n                teams = Teams.query.filter(Teams.id == q).order_by(Teams.id.asc()).all()\n            else:\n                teams = []\n                errors.append(\"Your ID search term is not numeric\")\n        elif field == \"name\":\n            teams = (\n                Teams.query.filter(Teams.name.like(\"%{}%\".format(q)))\n                .order_by(Teams.id.asc())\n                .all()\n            )\n        elif field == \"email\":\n            teams = (\n                Teams.query.filter(Teams.email.like(\"%{}%\".format(q)))\n                .order_by(Teams.id.asc())\n                .all()\n            )\n        elif field == \"affiliation\":\n            teams = (\n                Teams.query.filter(Teams.affiliation.like(\"%{}%\".format(q)))\n                .order_by(Teams.id.asc())\n                .all()\n            )\n        return render_template(\n            \"admin/teams/teams.html\",\n            teams=teams,\n            pages=None,\n            curr_page=None,\n            q=q,\n            field=field,\n        )\n\n    page = abs(int(page))\n    results_per_page = 50\n    page_start = results_per_page * (page - 1)\n    page_end = results_per_page * (page - 1) + results_per_page\n\n    teams = Teams.query.order_by(Teams.id.asc()).slice(page_start, page_end).all()\n    count = db.session.query(db.func.count(Teams.id)).first()[0]\n    pages = int(count / results_per_page) + (count % results_per_page > 0)\n    return render_template(\n        \"admin/teams/teams.html\", teams=teams, pages=pages, curr_page=page\n    )\n\n\n@admin.route(\"/admin/teams/new\")\n@admins_only\ndef teams_new():\n    return render_template(\"admin/teams/new.html\")\n\n\n@admin.route(\"/admin/teams/<int:team_id>\")\n@admins_only\ndef teams_detail(team_id):\n    team = Teams.query.filter_by(id=team_id).first_or_404()\n\n    # Get members\n    members = team.members\n    member_ids = [member.id for member in members]\n\n    # Get Solves for all members\n    solves = team.get_solves(admin=True)\n    fails = team.get_fails(admin=True)\n    awards = team.get_awards(admin=True)\n    score = team.get_score(admin=True)\n    place = team.get_place(admin=True)\n\n    # Get missing Challenges for all members\n    # TODO: How do you mark a missing challenge for a team?\n    solve_ids = [s.challenge_id for s in solves]\n    missing = Challenges.query.filter(not_(Challenges.id.in_(solve_ids))).all()\n\n    # Get addresses for all members\n    addrs = (\n        Tracking.query.filter(Tracking.user_id.in_(member_ids))\n        .order_by(Tracking.date.desc())\n        .all()\n    )\n\n    return render_template(\n        \"admin/teams/team.html\",\n        team=team,\n        members=members,\n        score=score,\n        place=place,\n        solves=solves,\n        fails=fails,\n        missing=missing,\n        awards=awards,\n        addrs=addrs,\n    )\n", "path": "CTFd/admin/teams.py"}], "after_files": [{"content": "from flask import render_template, request\nfrom CTFd.utils import get_config\nfrom CTFd.utils.decorators import admins_only\nfrom CTFd.utils.modes import TEAMS_MODE\nfrom CTFd.models import db, Users, Challenges, Tracking\nfrom CTFd.admin import admin\nfrom CTFd.utils.helpers import get_errors\n\nfrom sqlalchemy.sql import not_\n\n\n@admin.route(\"/admin/users\")\n@admins_only\ndef users_listing():\n    page = abs(request.args.get(\"page\", 1, type=int))\n    q = request.args.get(\"q\")\n    if q:\n        field = request.args.get(\"field\")\n        users = []\n        errors = get_errors()\n        if field == \"id\":\n            if q.isnumeric():\n                users = Users.query.filter(Users.id == q).order_by(Users.id.asc()).all()\n            else:\n                users = []\n                errors.append(\"Your ID search term is not numeric\")\n        elif field == \"name\":\n            users = (\n                Users.query.filter(Users.name.like(\"%{}%\".format(q)))\n                .order_by(Users.id.asc())\n                .all()\n            )\n        elif field == \"email\":\n            users = (\n                Users.query.filter(Users.email.like(\"%{}%\".format(q)))\n                .order_by(Users.id.asc())\n                .all()\n            )\n        elif field == \"affiliation\":\n            users = (\n                Users.query.filter(Users.affiliation.like(\"%{}%\".format(q)))\n                .order_by(Users.id.asc())\n                .all()\n            )\n        elif 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                .all()\n            )\n\n        return render_template(\n            \"admin/users/users.html\",\n            users=users,\n            pages=0,\n            curr_page=None,\n            q=q,\n            field=field,\n        )\n\n    page = abs(int(page))\n    results_per_page = 50\n    page_start = results_per_page * (page - 1)\n    page_end = results_per_page * (page - 1) + results_per_page\n\n    users = Users.query.order_by(Users.id.asc()).slice(page_start, page_end).all()\n    count = db.session.query(db.func.count(Users.id)).first()[0]\n    pages = int(count / results_per_page) + (count % results_per_page > 0)\n\n    return render_template(\n        \"admin/users/users.html\", users=users, pages=pages, curr_page=page\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"}, {"content": "from flask import render_template, request\nfrom CTFd.utils.decorators import admins_only\nfrom CTFd.models import db, Teams, Challenges, Tracking\nfrom CTFd.admin import admin\nfrom CTFd.utils.helpers import get_errors\n\nfrom sqlalchemy.sql import not_\n\n\n@admin.route(\"/admin/teams\")\n@admins_only\ndef teams_listing():\n    page = abs(request.args.get(\"page\", 1, type=int))\n    q = request.args.get(\"q\")\n    if q:\n        field = request.args.get(\"field\")\n        teams = []\n        errors = get_errors()\n        if field == \"id\":\n            if q.isnumeric():\n                teams = Teams.query.filter(Teams.id == q).order_by(Teams.id.asc()).all()\n            else:\n                teams = []\n                errors.append(\"Your ID search term is not numeric\")\n        elif field == \"name\":\n            teams = (\n                Teams.query.filter(Teams.name.like(\"%{}%\".format(q)))\n                .order_by(Teams.id.asc())\n                .all()\n            )\n        elif field == \"email\":\n            teams = (\n                Teams.query.filter(Teams.email.like(\"%{}%\".format(q)))\n                .order_by(Teams.id.asc())\n                .all()\n            )\n        elif field == \"affiliation\":\n            teams = (\n                Teams.query.filter(Teams.affiliation.like(\"%{}%\".format(q)))\n                .order_by(Teams.id.asc())\n                .all()\n            )\n        return render_template(\n            \"admin/teams/teams.html\",\n            teams=teams,\n            pages=0,\n            curr_page=None,\n            q=q,\n            field=field,\n        )\n\n    page = abs(int(page))\n    results_per_page = 50\n    page_start = results_per_page * (page - 1)\n    page_end = results_per_page * (page - 1) + results_per_page\n\n    teams = Teams.query.order_by(Teams.id.asc()).slice(page_start, page_end).all()\n    count = db.session.query(db.func.count(Teams.id)).first()[0]\n    pages = int(count / results_per_page) + (count % results_per_page > 0)\n    return render_template(\n        \"admin/teams/teams.html\", teams=teams, pages=pages, curr_page=page\n    )\n\n\n@admin.route(\"/admin/teams/new\")\n@admins_only\ndef teams_new():\n    return render_template(\"admin/teams/new.html\")\n\n\n@admin.route(\"/admin/teams/<int:team_id>\")\n@admins_only\ndef teams_detail(team_id):\n    team = Teams.query.filter_by(id=team_id).first_or_404()\n\n    # Get members\n    members = team.members\n    member_ids = [member.id for member in members]\n\n    # Get Solves for all members\n    solves = team.get_solves(admin=True)\n    fails = team.get_fails(admin=True)\n    awards = team.get_awards(admin=True)\n    score = team.get_score(admin=True)\n    place = team.get_place(admin=True)\n\n    # Get missing Challenges for all members\n    # TODO: How do you mark a missing challenge for a team?\n    solve_ids = [s.challenge_id for s in solves]\n    missing = Challenges.query.filter(not_(Challenges.id.in_(solve_ids))).all()\n\n    # Get addresses for all members\n    addrs = (\n        Tracking.query.filter(Tracking.user_id.in_(member_ids))\n        .order_by(Tracking.date.desc())\n        .all()\n    )\n\n    return render_template(\n        \"admin/teams/team.html\",\n        team=team,\n        members=members,\n        score=score,\n        place=place,\n        solves=solves,\n        fails=fails,\n        missing=missing,\n        awards=awards,\n        addrs=addrs,\n    )\n", "path": "CTFd/admin/teams.py"}]}