Skip to content

Commit

Permalink
fix: Fixed test suite for missing env var
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelloeater committed Sep 10, 2023
1 parent f29e440 commit 4fb4183
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
n.n.n / 2023-09-09
==================


* doc: Updated changelog and readme

v1.0.0 / 2023-09-09
===================
Expand Down
1 change: 1 addition & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ vars:
tasks:
default:
- task: test
- task: commit
test:
silent: false
interactive: false
Expand Down
2 changes: 1 addition & 1 deletion docs/fedi_gatus/shared/db.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Classes
`get_single_record(self) ‑> dict`
:

`get_top_lemmy_instances(self) ‑> list[fedi_gatus.shared.db.Model]`
`get_top_lemmy_instances(self, count=25) ‑> list[fedi_gatus.shared.db.Model]`
:

`initialize(self)`
Expand Down
9 changes: 6 additions & 3 deletions fedi_gatus/shared/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,17 @@ def __init__(self, *args, **kwargs):
def get_single_record(self) -> dict:
return self.select().get()

def get_top_lemmy_instances(self) -> list[Model]:
NUMBER_OF_SERVERS = int(os.getenv("NUMBER_OF_SERVERS"))
def get_top_lemmy_instances(self, count=25) -> list[Model]:
# TODO Add env var for count

if not os.getenv("TEST_MODE"):
count = int(os.getenv("NUMBER_OF_SERVERS"))
logging.info("Number of Rows:" + str(DbAccess.select().count()))
d = (
DbAccess.select()
.where(DbAccess.software_name == "Lemmy")
.order_by(DbAccess.stats_monthly_active_users)
.limit(NUMBER_OF_SERVERS)
.limit(count)
)
info = []
for i in d:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "fedi_gatus"
version = "v0.1.0"
version = "v1.0.0"
description = ""
authors = ["Jesse Schoepfer <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 4fb4183

Please sign in to comment.