Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cao zihao 201831990221 pick most popular articles #50

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified database.sqlite
Binary file not shown.
10 changes: 7 additions & 3 deletions service.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@


from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import or_
import os, uuid ,math, random
from flask import Flask, flash, request, redirect, url_for, session, jsonify, render_template, send_from_directory
from werkzeug.utils import secure_filename
from datetime import datetime, timedelta
from flask import Flask


basedir = os.path.abspath(os.path.dirname(__file__))
UPLOAD_FOLDER = basedir + '\static\pdf'
ALLOWED_EXTENSIONS = set(['pdf'])
Expand Down Expand Up @@ -152,7 +156,7 @@ def find_path_last_id(path):
# ======================================================================================================
@staticmethod
def sensitive_words_filter(text):
f = open('static/sensitive words/1.txt', 'r')
f = open('C:/Users/lenovo/Downloads/OAPS-TreeLib-master/OAPS-TreeLib-master/static/sensitive words/1.txt', 'r')
CZH-Gaizka marked this conversation as resolved.
Show resolved Hide resolved
result = ''
flag = True
for line in f:
Expand Down Expand Up @@ -317,7 +321,7 @@ def get_subject(subjectID):
hot_article.append(x)

return render_template('subject.html', url=url, subject_id=subject.id, articles=articles, hot_article=hot_article, Tool=Tool)

return render_template('io.html', url=url, subject_id=subject.id, articles=articles, hot_article=hot_article, Tool=Tool)
CZH-Gaizka marked this conversation as resolved.
Show resolved Hide resolved
# ============================================================================================
# before request
# ============================================================================================
Expand Down Expand Up @@ -381,7 +385,7 @@ def find_subjects(subject, count):
find_subjects(subject, count + 1)

subjects = Subject.query.filter_by(pid='None').all()
out.write('{% extends "template.html" %}' + '\n')
out.write( '{% extends "template.html" %}' + '\n')
out.write('{% block content %}' + '\n')
for subject in subjects:
find_subjects(subject, 0)
Expand Down
204 changes: 133 additions & 71 deletions templates/io.html
Original file line number Diff line number Diff line change
@@ -1,76 +1,138 @@
{% extends "template.html" %}
{% block content %}
<body>
<body >

<div style="background-color:#00253a;height:auto;width:30%;float:left;box-sizing: border-box;">
<h1 style="background-color: lightblue;color:#00253a;">Subjects</h1>>
<a href="subject/1">Physical Sciences</a><br>
&emsp;
<a href="subject/8">Physics</a><br>
&emsp;
&emsp;
<a href="subject/11">Astronomy</a><br>
&emsp;
&emsp;
<a href="subject/12">Quantum Mechanics</a><br>
&emsp;
<a href="subject/9">Chemistry</a><br>
&emsp;
<a href="subject/10">Environmental Sciences</a><br>
<a href="subject/2">Social Sciences</a><br>
&emsp;
<a href="subject/13">Anthropology</a><br>
&emsp;
<a href="subject/14">Sustainability Science</a><br>
<a href="subject/3">Biological Sciences</a><br>
&emsp;
<a href="subject/15">Cell Biology</a><br>
&emsp;
&emsp;
<a href="subject/37">病理学</a><br>
&emsp;
<a href="subject/16">Genetics</a><br>
&emsp;
<a href="subject/17">Neuroscience</a><br>
&emsp;
<a href="subject/18">Plant Biology</a><br>
&emsp;
<a href="subject/19">Developmental Biology</a><br>
&emsp;
<a href="subject/20">System Biology</a><br>
&emsp;
<a href="subject/21">Biochemistry</a><br>
&emsp;
<a href="subject/22">Biophysics and Computational Biology</a><br>
<a href="subject/4">Computer Sciences</a><br>
&emsp;
<a href="subject/23">Machine Learning</a><br>
&emsp;
<a href="subject/24">Computational Biology</a><br>
&emsp;
<a href="subject/25">Computational Complexity</a><br>
&emsp;
<a href="subject/26">Computational Linguistics</a><br>
<a href="subject/5">Statistics</a><br>
&emsp;
<a href="subject/27">Applied Statistics</a><br>
&emsp;
<a href="subject/28">Mathematical Statistics</a><br>
<a href="subject/6">Mathematics</a><br>
&emsp;
<a href="subject/29">Graphy Theory</a><br>
&emsp;
<a href="subject/30">Number Theory</a><br>
<a href="subject/7">Medical Sciences</a><br>
&emsp;
<a href="subject/31">Breast Cancer</a><br>
&emsp;
<a href="subject/32">Ebola Virus</a><br>
&emsp;
<a href="subject/33">Epidemics</a><br>
&emsp;
<a href="subject/34">Dermatology General</a><br>
&emsp;
<a href="subject/35">Immunity</a><br>
&emsp;
<a href="subject/36">Obesity</a><br>

</div>
<div style="background-color:aquamarine;height:1423px;width:700px;float: left;box-sizing: border-box;">
<h1 style="background-color: rgb(0, 56, 37);color:azure;">Top5 Articles</h1>
&emsp;
<a href="article/1">Lab 3</a><br>
&emsp;
<a href="article/2">Draft 1</a><br>

&emsp;
<a href="article/3">my Article</a><br>

&emsp;
<a href="article/5">sweet texts</a><br>
&emsp;
<a href="article/7">Astronaut </a><br>
&emsp;
<h1 style="background-color: rgb(0, 56, 37);color:azure;">All Articles</h1>
&emsp;
<a href="article/1">Lab 3<span style="float: right;">2019-11-09 12:00:23</span></a><br>
&emsp;
<a href="article/2">Draft 1<span style="float: right;">2019-11-09 13:01:09</span></a><br>

&emsp;
<a href="article/3">my Article<span style="float: right;">2020-03-18 06:41:50</span></a><br>

&emsp;
<a href="article/5">sweet texts<span style="float: right;">2020-03-19 05:57:19</span></a><br>
&emsp;
<a href="article/7">Astronaut<span style="float: right;">2020-03-19 07:28:16</span> </a><br>
&emsp;
<a href="article/8">Spaceships<span style="float: right;">2020-03-19 07:29:33</span></a><br>
&emsp;
<a href="article/9">Venus<span style="float: right;">2020-03-19 07:30:34</span></a><br>

&emsp;
<a href="article/10">The Article<span style="float: right;">2020-04-19 20:30:33</span></a><br>
CZH-Gaizka marked this conversation as resolved.
Show resolved Hide resolved

&emsp;
<a href="article/11">Physical science article<span style="float: right;">2020-04-19 20:32:36</span></a><br>
&emsp;
<a href="article/12">The Article<span style="float: right;">2020-04-19 20:34:42</span></a><br>
&emsp;
<a href="article/13">My Favourite<span style="float: right;">2020-04-19 20:37:13</span></a><br>
&emsp;
<a href="article/14">The Legendary<span style="float: right;">2020-04-19 20:38:44</span></a><br>

&emsp;
<a href="article/15">More<span style="float: right;">2020-04-19 20:40:18</span></a><br>

&emsp;
<a href="article/16">New Article<span style="float: right;">2020-04-19 20:42:57</span></a><br>
&emsp;
<a href="article/17">Fundamentals of Physical Sciences<span style="float: right;">2020-04-19 20:45:24</span></a><br>
&emsp;
<a href="article/18">Physical sciences in Action<span style="float: right;">2020-04-19 20:46:25</span></a><br>
&emsp;
<a href="article/19">Physical Sciences Cook book<span style="float: right;">2020-04-19 20:48:27</span> </a><br>
</div>

<a href="subject/1">Physical Sciences</a><br>
&emsp;
<a href="subject/8">Physics</a><br>
&emsp;
&emsp;
<a href="subject/11">Astronomy</a><br>
&emsp;
&emsp;
<a href="subject/12">Quantum Mechanics</a><br>
&emsp;
<a href="subject/9">Chemistry</a><br>
&emsp;
<a href="subject/10">Environmental Sciences</a><br>
<a href="subject/2">Social Sciences</a><br>
&emsp;
<a href="subject/13">Anthropology</a><br>
&emsp;
<a href="subject/14">Sustainability Science</a><br>
<a href="subject/3">Biological Sciences</a><br>
&emsp;
<a href="subject/15">Cell Biology</a><br>
&emsp;
&emsp;
<a href="subject/37">病理学</a><br>
&emsp;
<a href="subject/16">Genetics</a><br>
&emsp;
<a href="subject/17">Neuroscience</a><br>
&emsp;
<a href="subject/18">Plant Biology</a><br>
&emsp;
<a href="subject/19">Developmental Biology</a><br>
&emsp;
<a href="subject/20">System Biology</a><br>
&emsp;
<a href="subject/21">Biochemistry</a><br>
&emsp;
<a href="subject/22">Biophysics and Computational Biology</a><br>
<a href="subject/4">Computer Sciences</a><br>
&emsp;
<a href="subject/23">Machine Learning</a><br>
&emsp;
<a href="subject/24">Computational Biology</a><br>
&emsp;
<a href="subject/25">Computational Complexity</a><br>
&emsp;
<a href="subject/26">Computational Linguistics</a><br>
<a href="subject/5">Statistics</a><br>
&emsp;
<a href="subject/27">Applied Statistics</a><br>
&emsp;
<a href="subject/28">Mathematical Statistics</a><br>
<a href="subject/6">Mathematics</a><br>
&emsp;
<a href="subject/29">Graphy Theory</a><br>
&emsp;
<a href="subject/30">Number Theory</a><br>
<a href="subject/7">Medical Sciences</a><br>
&emsp;
<a href="subject/31">Breast Cancer</a><br>
&emsp;
<a href="subject/32">Ebola Virus</a><br>
&emsp;
<a href="subject/33">Epidemics</a><br>
&emsp;
<a href="subject/34">Dermatology General</a><br>
&emsp;
<a href="subject/35">Immunity</a><br>
&emsp;
<a href="subject/36">Obesity</a><br>
</body>
{% endblock %}
2 changes: 1 addition & 1 deletion templates/subject.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


</head>
<body>
<body >
CZH-Gaizka marked this conversation as resolved.
Show resolved Hide resolved


{% block head %}
Expand Down
8 changes: 6 additions & 2 deletions templates/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
<style>

footer{
background-color: #323a3a;
background-color: #0c7979;
color: #dadada;
padding-top: 2rem;
clear: both;

}
hr.light{
border-top: 1px solid #d5d5d5;
Expand All @@ -41,6 +43,7 @@
{% endblock %}
</head>
<body>
<div style="clear: both;">
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<ul class="navbar-nav">
<li class="nav-item active">
Expand All @@ -61,9 +64,10 @@
</li>
</ul>
</nav>
</div>


<div style="font-size: 20px; line-height: 1.8; text-shadow: 0.3px 0.3px black; font-family: Times, serif;" class="col-sm-10 container">
<div style="font-size: 20px; line-height: 1.8; text-shadow: 0.3px 0.3px rgb(0, 0, 0); font-family: Times, serif;" class="col-sm-10 container">
CZH-Gaizka marked this conversation as resolved.
Show resolved Hide resolved
{% block content %}

{% endblock %}
Expand Down