Skip to content

171: Make sure all active WORK show on resource forecast. Removing so… #2433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions epictrack-api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
alembic==1.13.3
alembic==1.14.0
aniso8601==9.0.1
attrs==24.2.0
cachelib==0.9.0
certifi==2024.8.30
cffi==1.17.1
charset-normalizer==3.4.0
click==8.1.7
contourpy==1.3.0
contourpy==1.3.1
cryptography==43.0.3
cycler==0.12.1
dpath==2.2.0
ecdsa==0.19.0
et-xmlfile==1.1.0
et_xmlfile==2.0.0
Flask==2.2.5
Flask-Caching==2.3.0
flask-jwt-oidc==0.3.0
Expand All @@ -38,7 +38,7 @@ matplotlib==3.7.4
natsort==8.4.0
numpy==1.26.4
openpyxl==3.0.10
packaging==24.1
packaging==24.2
pandas==2.0.2
pillow==11.0.0
psycopg2-binary==2.9.10
Expand All @@ -52,7 +52,7 @@ pytz==2024.2
referencing==0.35.1
reportlab==3.6.12
requests==2.32.3
rpds-py==0.20.0
rpds-py==0.21.0
rsa==4.9
six==1.16.0
SQLAlchemy==2.0.17
Expand Down
22 changes: 11 additions & 11 deletions epictrack-api/src/api/reports/resource_forecast_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def _fetch_data(self, report_date: datetime):
)
.join(SubType, Project.sub_type_id == SubType.id)
.join(Type, Project.type_id == Type.id)
# TODO: Make sure to add the region_id_env and region_id_flnro to the Project model
.join(env_region, env_region.id == Project.region_id_env)
.join(nrs_region, nrs_region.id == Project.region_id_flnro)
.join(
Expand Down Expand Up @@ -269,8 +270,8 @@ def _get_less_than_end_date_query(self):
and_(
WorkPhase.id == EventConfiguration.work_phase_id,
WorkPhase.is_active.is_(True),
WorkPhase.sort_order
== 1, # indicate the work phase is the first one
# Temporarily removing this due to TRACK-171
# WorkPhase.sort_order == 1, # indicate the work phase is the first one
WorkPhase.is_deleted.is_(False),
),
)
Expand Down Expand Up @@ -377,34 +378,33 @@ def generate_report(self, report_date, return_type):
"""Generates a report and returns it"""
self._set_month_labels(report_date)
works = self._fetch_data(report_date)
current_app.logger.info(f"Works: {works}")
work_ids = set((work.work_id for work in works))
current_app.logger.info(f"Work IDs: {work_ids}")
works = super()._format_data(works)
events = self._get_events(work_ids)
current_app.logger.info(f"Events: {events}")
current_app.logger.debug(f"Events: {events}")

start_events = self._filter_start_events(events)
current_app.logger.info(f"Start Events: {start_events}")
current_app.logger.debug(f"Start Events: {start_events}")

start_events = {y: self._filter_work_events(y, start_events) for y in work_ids}
current_app.logger.info(f"Filtered Start Events: {start_events}")
current_app.logger.debug(f"Filtered Start Events: {start_events}")

work_data = self._update_month_labels(works, start_events)
current_app.logger.info(f"Updated Work Data with Month Labels: {work_data}")
current_app.logger.debug(f"Updated Work Data with Month Labels: {work_data}")

special_histories = self._fetch_works_special_history(work_ids, report_date)
current_app.logger.info(f"Special Histories: {special_histories}")
current_app.logger.debug(f"Special Histories: {special_histories}")

work_data = self._update_special_history(work_data, special_histories)
current_app.logger.info(f"Updated Work Data with Special Histories: {work_data}")
current_app.logger.debug(f"Updated Work Data with Special Histories: {work_data}")

data = self._format_data(work_data)
current_app.logger.info(f"Formatted Data: {data}")
current_app.logger.debug(f"Formatted Data: {data}")
if not data:
return {}, None
second_phases = self._fetch_second_phases(events, work_ids)
current_app.logger.info(f"Second Phases: {second_phases}")
current_app.logger.debug(f"Second Phases: {second_phases}")
data = self._sort_data(data, second_phases)
if return_type == "json" and data:
return data, None
Expand Down
Loading