view roundup_content_data/__init__.py @ 15:d0c439d1e833

Prepare for tracker entries without priority. * Extend issues_to_quantities to count entries with priority 'None'. The regular classic template enforces a priority value, but some trackers don't, e.g. the 'fast-decomposed' variant used by Intevation (https://hg.intevation.de/roundup/fast-decomposed/) uses other fields for a scrum like workflow that show the order of issues as a float value. In order to get all issues, we also have to collect them. Implement it in a backwards compatible manner for save_stats_in_db() by a keyword argument that is off by default. This is just a preparation as the database must also accept an additional column. * Cleanup some superfluous whitespace, remove an unused import and add copyright 208 year.
author Bernhard Reiter <bernhard@intevation.de>
date Fri, 06 Jul 2018 17:36:21 +0200
parents 99e2e0e17103
children adca5b3780d2
line wrap: on
line source
#!/usr/bin/env python

""" supplys the data needed to comunicate with the roundup-server,
and the sqlite database. Represents the types of errors used in roundup.

author: Sascha L. Teichmann <sascha.teichmann@intevation.de>
author: Bernhard Reiter <bernhard@intevation.de>
author: Sean Engelhardt <sean.engelhardt@intevation.de>

(c) 2010,2015 by Intevation GmbH

This is Free Software unter the terms of the
GNU GENERAL PUBLIC LICENSE Version 3 or later.
See http://www.gnu.org/licenses/gpl-3.0.txt for details
"""

import os

#Add desired sqlite databases here
DATABASE_REFERENCCE = os.path.dirname(os.path.realpath(__file__)) + "/test_reference.db"
DATABASE_DEMO = os.path.dirname(os.path.realpath(__file__)) + "/demo.db"
DATABASE_ERRORDB = os.path.dirname(os.path.realpath(__file__)) + "/errordatabase.db"
DATABASE_TECH_INTERN = os.path.dirname(os.path.realpath(__file__)) + "/tech_intern.db"
DATABASE_INT_TEST = os.path.dirname(os.path.realpath(__file__)) + "/int_test.db"

COLUMNS= [
    "critical", "urgent", "bug", "feature", "wish",
]

data_dict = {
    "date": [],
    "critical": [],
    "urgent": [],
    "bug": [],
    "feature": [],
    "wish": []
}

#SQL

#DEMO System
SELECT_ALL = """
SELECT strftime("%Y-%m-%dT%H:%M:%S", timestamp),
    critical,
    urgent,
    bug,
    feature,
    wish
FROM issues
ORDER BY timestamp
"""

SELECT_WHERE = """
SELECT strftime("%Y-%m-%dT%H:%M:%S", timestamp),
    critical,
    urgent,
    bug,
    feature,
    wish
FROM issues
WHERE {}
ORDER BY timestamp
"""


CREATE_DB = """
CREATE TABLE issues (
    timestamp TIMESTAMP NOT NULL UNIQUE DEFAULT current_timestamp,
    critical INTEGER NOT NULL DEFAULT 0,
    urgent INTEGER NOT NULL DEFAULT 0,
    bug INTEGER NOT NULL DEFAULT 0,
    feature INTEGER NOT NULL DEFAULT 0,
    wish INTEGER NOT NULL DEFAULT 0
)
"""


INSERT_NEW = """
    INSERT INTO issues (critical, urgent, bug, feature, wish)
    VALUES (?, ?, ?, ?, ?)
"""

#Referecen DB:
SELECT_ALL_REFERENCE = """
SELECT strftime("%Y-%m-%dT%H:%M:%S", sample_time),
    critical,
    major,
    crash,
    normal,
    minor,
    wishlist
FROM issues
ORDER BY sample_time
"""
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)