diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2021-05-18 20:26:07 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2021-05-18 20:26:07 +0100 |
commit | 0f21c97f06bccd2260931e7543a24dc618f355b4 (patch) | |
tree | 61ab91a2c9665c2e67b7581652dd2939109266c7 /datamaps/plugins | |
parent | 62617d6ef952c24e134b4bc403263ed990a42ec8 (diff) |
fixed test related to getting the correct year from a Month()
Diffstat (limited to 'datamaps/plugins')
-rw-r--r-- | datamaps/plugins/dft/master.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/datamaps/plugins/dft/master.py b/datamaps/plugins/dft/master.py index ac81bd9..324b63d 100644 --- a/datamaps/plugins/dft/master.py +++ b/datamaps/plugins/dft/master.py @@ -1,14 +1,13 @@ -import re import datetime import logging +import re import unicodedata from pathlib import Path -from typing import List, Tuple, Iterable, Optional, Any +from typing import Any, Iterable, List, Optional, Tuple +from datamaps.core.temporal import Quarter from datamaps.plugins.dft.portfolio import project_data_from_master from datamaps.process.cleansers import DATE_REGEX_4 -from datamaps.core.temporal import Quarter - from openpyxl import load_workbook logger = logging.getLogger("bcompiler.utils") @@ -157,9 +156,14 @@ class Master: self._quarter = quarter self._declared_month = declared_month self.path = path + if self._declared_month: + idxs = [x.month_int for x in self._quarter.months] + m_idx = idxs.index(self._declared_month) + self.year = self._quarter.months[m_idx].year + else: + self.year = self._quarter.year self._data = project_data_from_master(self.path) self._project_titles = [item for item in self.data.keys()] - self.year = self._quarter.year def __getitem__(self, project_name): return ProjectData(self._data[project_name]) @@ -217,9 +221,7 @@ class Master: 12: "December", } return [ - m - for m in self.quarter.months - if m.name == months[self._declared_month] + m for m in self.quarter.months if m.name == months[self._declared_month] ][0] @property |