view roundup_cc.py @ 25:7161ce4e7ab1

The web-based display is dynamically generated. * All graphs are passed in one object. All graphs are passed in one object. The graphs are generated iteratiev and assigned a color. * roundup_cc.py can count how many issues are in which state.
author Magnus Schieder <mschieder@intevation.de>
date Mon, 12 Nov 2018 18:03:26 +0100
parents
children 761ee2351f58
line wrap: on
line source
#!/usr/bin/env python3
"""Connect to roundup-tracker and save status to db.

Run periodically as often as you want data points to be saved.
"""

import configparser
import argparse

from collect_issues import save_stats_in_db
import roundup_content_data as rcd

PRIO = "critical, urgent, bug, feature, wish"
STATES = "unread, deferred, chatting, need_eg, in_progress, testing, done_cbb, resolved"

def main():

    parser = argparse.ArgumentParser()
    parser.add_argument("config_file", type=str, metavar="[config file]")
    args = parser.parse_args()

    config = configparser.ConfigParser()
    config.read(args.config_file)

    base_url = config.get("URL", "BaseURL")

    user = config.get("LOGIN","Username")
    password = config.get("LOGIN", "Password")

    login_parameters = (
        ("__login_name", user),
        ("__login_password", password),
        ("@action", "Login"),
        )

    database_file = config.get("DB", "DatabaseFile")

    keywords = config.get("SEARCH", "Keywords", fallback="").split(", ")

    search = config.get("SEARCH", "Search", fallback="prio")
    if search == "prio":
        list_of_columns = config.get("SEARCH", "Columns", fallback=PRIO).split(", ")
        status = config.get("SEARCH", "Status", fallback="").split(", ")
        include_no_prio = config.getboolean("SEARCH", "IncludeNoPrio", fallback= False)
        if include_no_prio:
            list_of_columns += ["None"]

    elif search == "status":
        list_of_columns = config.get("SEARCH", "Status", fallback=STATES).split(", ")
        status = [""]

    select_all, select_where, create_db, insert_new = \
        rcd.build_sql_commands(list_of_columns)

    save_stats_in_db(search, login_parameters, base_url, database_file,
                    list_of_columns, create_db, insert_new, keywords, status)

if __name__ == '__main__':
    main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)