Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arihant2math committed Nov 7, 2023
1 parent e41d238 commit 6bd8a94
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
3 changes: 2 additions & 1 deletion gunicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@

def app():
BaseConfig.SECRET_KEY = os.environ.get("SECRET_KEY")
BaseConfig.SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL")
if os.environ.get("DATABASE_URL") is not None:
BaseConfig.SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL")
return create_app()
6 changes: 6 additions & 0 deletions website/bp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,9 @@ def agent(symbol):
@main_bp.route("/leaderboard/")
def leaderboard():
return render_template("leaderboard.html", status=autotraders.get_status())


@main_bp.route("/create-all/")
def create_all():
db.create_all()
return "Created all tables"
14 changes: 7 additions & 7 deletions website/bp/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ def search():
if check_filters_system(item, filters):
unweighted_map.append((item, weight(query, str(item.symbol))))
if "waypoint" in to_query and (
not fast_search or quick_weight(query, str(item.symbol)) > -0.1
not fast_search or quick_weight(query, str(item.symbol)) > -0.1
):
for waypoint in item.waypoints:
if quick_weight(
query, str(waypoint.symbol)
query, str(waypoint.symbol)
) > 0 and check_filters_waypoint(waypoint, filters):
unweighted_map.append(
(waypoint, weight(query, str(waypoint.symbol)))
Expand All @@ -90,23 +90,23 @@ def search():
if "faction" in to_query:
for item in faction_data:
if (
quick_weight(query, item.symbol) > -0.25
or quick_weight(query, item.name) > -0.25
quick_weight(query, item.symbol) > -0.25
or quick_weight(query, item.name) > -0.25
) and check_filters_faction(item, filters):
unweighted_map.append((item, weight(query, str(item.symbol))))
t1_6 = time.time()
if "ship" in to_query and session is not None:
ship_data = Ship.all(session)[1]
for item in ship_data:
if quick_weight(query, item.symbol) > -0.25 and check_filters_ship(
item, filters
item, filters
):
unweighted_map.append((item, weight(query, item.symbol)))
if "contract" in to_query and session is not None:
contract_data = Contract.all(session)[1]
for item in contract_data:
if quick_weight(query, item.contract_id) > -0.7 and check_filters_contract(
item, filters
item, filters
):
unweighted_map.append((item, weight(query, str(item.contract_id))))
amap = [
Expand All @@ -119,7 +119,7 @@ def search():
# print(t1_2 - t1, t1_3 - t1_2, t1_4 - t1_3, t1_5 - t1_4, t1_6 - t1_5, t2 - t1_6)

def paginate(p, num_per_page): # TODO: test properly
return amap[(p - 1) * num_per_page : p * num_per_page], len(amap)
return amap[(p - 1) * num_per_page: p * num_per_page], len(amap)

paginated_list = PaginatedList(paginate, page, 100)
new_li = paginated_return(paginated_list, page)
Expand Down
2 changes: 1 addition & 1 deletion website/templates/landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ <h5>Get Started</h5>
<p>Manage all your tokens with a unified interface</p>
<span>
<a href="/login" class="btn btn-primary">Login</a>
<a href="/signup" class="btn btn-primary">Signup</a>
<a href="/register" class="btn btn-primary">Register</a>
</span>
</div>
</div>
Expand Down

0 comments on commit 6bd8a94

Please sign in to comment.