Sort by number of data points (#105)

This commit is contained in:
Soxoj
2021-05-22 20:23:53 +03:00
parent 8de1830cf3
commit 4aeacef07d
4 changed files with 25 additions and 3 deletions
+11
View File
@@ -33,6 +33,7 @@ from .report import (
SUPPORTED_JSON_REPORT_FORMATS,
save_json_report,
get_plaintext_report,
sort_report_by_data_points,
)
from .sites import MaigretDatabase
from .submit import submit_dialog
@@ -433,6 +434,13 @@ def setup_arguments_parser():
help=f"Generate a JSON report of specific type: {', '.join(SUPPORTED_JSON_REPORT_FORMATS)}"
" (one report per username).",
)
parser.add_argument(
"--reports-sorting",
default='default',
choices=('default', 'data'),
help="Method of results sorting in reports (default: in order of getting the result)",
)
return parser
@@ -613,6 +621,9 @@ async def main():
notify_about_errors(results, query_notify)
if args.reports_sorting == "data":
results = sort_report_by_data_points(results)
general_results.append((username, id_type, results))
# TODO: tests