Skip to content

Commit 6db2d84

Browse files
add tag_result page
1 parent bd397e0 commit 6db2d84

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ def contest_search():
8888
@app.route('/tag_search',methods=['POST'])
8989
def tag_search():
9090
tagName=request.args.get('tagName')
91-
return render_template('tag_result.html',tagName=tagName)
91+
problems=db.session.query(Problem_Tag).filter_by(first_tag=tagName)
92+
return render_template('tag_result.html',tagName=tagName,problems=problems)
9293

9394
@app.route('/search/<problem_id>/<int:page>', methods=['GET','POST'])
9495
def contest_get(problem_id,page=1):

templates/search.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ <h3>新着問題</h3>
7878
</thead> {% for problem in problems%}
7979
<tbody>
8080
<tr>
81-
<th scope="row">{{loop.index}}</th>
81+
<td scope="row">{{loop.index}}</td>
8282
<td>
8383
<a href="/search/{{problem[1]}}/1?contestname={{problem[0]}}" method="POST">{{problem[0]}}</a>
8484
</td>

templates/tag_result.html

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<title>AtCoder Editorials</title>
2929
</head>
3030

31-
<body style="padding-top:5rem">
31+
<body style="padding-top:5rem container-fluid">
3232
<!-- Google Tag Manager (noscript) -->
3333
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WW39BS6" height="0" width="0"
3434
style="display:none;visibility:hidden"></iframe></noscript>
@@ -57,6 +57,27 @@
5757
</div>
5858
</nav>
5959
<h1>{{tagName}}</h1>
60+
<div>
61+
<table class="table table-borderd">
62+
<thead class="thead-light">
63+
<tr>
64+
<th scope="col">#</th>
65+
<th scope="col">名前</th>
66+
</tr>
67+
</thead> {% for problem in problems%}
68+
<tbody>
69+
<tr>
70+
<td scope="row">{{loop.index}}</td>
71+
<td>
72+
<a href="/search/{{problem.problem_official_name}}/1?contestname={{problem.problem_name}}" method="POST">{{problem_name}}</a>
73+
</td>
74+
</tr>
75+
{%endfor%}
76+
</tbody>
77+
78+
</table>
79+
</div>
80+
6081

6182

6283
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>

0 commit comments

Comments
 (0)