Compare commits
No commits in common. "master" and "v1.6.0" have entirely different histories.
|
@ -253,7 +253,7 @@ class SqliteDb(ISqlDatabaseBackend):
|
|||
# If set False, the returned connection may be shared across multiple threads. When using multiple threads with the same connection writing operations should be serialized by the user to avoid data corruption
|
||||
# I hope it's safe here but I'm not 100% sure though. Anyway, if the database gets corrupt, it not a big deal since this memory resident database gets reconstructed from the sql file...
|
||||
|
||||
if sqlite_db_path == ':memory:' or not sqlite_db_path.exists():
|
||||
if sqlite_db_path != ':memory:' and not sqlite_db_path.exists():
|
||||
logging.debug('creating sqlite database in %s', sqlite_db_path)
|
||||
self._con = sqlite3.connect(sqlite_db_path, check_same_thread=check_same_thread)
|
||||
else:
|
||||
|
|
|
@ -315,7 +315,7 @@ def draw_machine_age_pyramid_graph(inventory):
|
|||
:param Inventory inventory: the inventory database
|
||||
"""
|
||||
|
||||
oldest_age = 25
|
||||
oldest_age = 20
|
||||
age_histogram = np.zeros(shape=(oldest_age))
|
||||
|
||||
rows = inventory.query("SELECT * FROM machines")
|
||||
|
@ -328,9 +328,7 @@ def draw_machine_age_pyramid_graph(inventory):
|
|||
if purchase_date is not None:
|
||||
purchase_time = matplotlib.dates.date2num(purchase_date.date()) # noqa: F841
|
||||
age = datetime.datetime.now() - purchase_date
|
||||
age_in_years = age.days // 365
|
||||
if age_in_years < oldest_age:
|
||||
age_histogram[age_in_years] += 1
|
||||
age_histogram[age.days // 365] += 1
|
||||
# print(name, age)
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
|
@ -351,7 +349,7 @@ def draw_core_age_pyramid_graph(inventory):
|
|||
:param Inventory inventory: the inventory database
|
||||
"""
|
||||
|
||||
oldest_age = 25
|
||||
oldest_age = 20
|
||||
age_histogram = np.zeros(shape=(oldest_age))
|
||||
|
||||
rows = inventory.query("SELECT * FROM machines")
|
||||
|
@ -364,9 +362,7 @@ def draw_core_age_pyramid_graph(inventory):
|
|||
if purchase_date is not None:
|
||||
purchase_time = matplotlib.dates.date2num(purchase_date.date()) # noqa: F841
|
||||
age = datetime.datetime.now() - purchase_date
|
||||
age_in_years = age.days // 365
|
||||
if age_in_years < oldest_age:
|
||||
age_histogram[age_in_years] += inventory.get_num_cores(name)
|
||||
age_histogram[age.days // 365] += inventory.get_num_cores(name)
|
||||
# print(name, age)
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
|
|
Loading…
Reference in New Issue