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

Omit unrestricted queries from the markdown table #20

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion backlogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ def render_table(data):
for conf in data["queries"]:
good, issue_count = check_backlog(conf)
url = data["web"] + "?" + conf["query"]
limits = "<" + str(conf["max"] + 1) if "max" in conf else ""
# Omit unrestricted queries from the table
if "max" not in conf:
continue
limits = "<" + str(conf["max"] + 1)
if "min" in conf:
limits += ", >" + str(conf["min"] - 1)
rows.append([
Expand Down
16 changes: 15 additions & 1 deletion tests/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def test_influxdb(self):

def test_markdown(self):
scenarios = [
{"icon": "&#x1F49A;", "limit": "", "data": {}},
{"icon": "&#x1F534;", "limit": "<2", "data": {"max": 1}},
{"icon": "&#x1F49A;", "limit": "<5, >0", "data": {"min": 1, "max": 4}},
{"icon": "&#x1F534;", "limit": "<5, >2", "data": {"min": 3, "max": 4}},
Expand All @@ -129,3 +128,18 @@ def test_markdown(self):
scenario["icon"]],
],
)

# A query with no limits will not be included in the table
backlogger.data["queries"] = [{"title": "Workable Backlog", "query": "query_id=123"}]
backlogger.json_rest = MagicMock(
side_effect=[
{
"issues": [],
"total_count": 2,
},
]
)
self.assertEqual(
backlogger.render_table(backlogger.data),
[]
)
Loading