Skip to content

Commit

Permalink
change: display 2 weeks of velocity and the total burn down chart as …
Browse files Browse the repository at this point in the history
…the charts for the overview page
  • Loading branch information
aricma committed Jan 14, 2024
1 parent 5320e87 commit b9d7a0c
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 16 deletions.
73 changes: 59 additions & 14 deletions server/private_html_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def server_error_exception_handler(_, exc: HTTPException):
path_to_tasks_json_file=str(envorinment.TASK_DUMMY_DATA_FILE_PATH)
)

chart_data_formatter = ChartDataFormatter(
detail_page_chart_data_formatter = ChartDataFormatter(
burn_down_forecast_decimator=BurnDownForecastDecimator(
max_amount_of_data_points_per_forecast=20
),
Expand All @@ -79,6 +79,15 @@ async def server_error_exception_handler(_, exc: HTTPException):
),
)

overview_chart_data_formatter = ChartDataFormatter(
burn_down_forecast_decimator=BurnDownForecastDecimator(
max_amount_of_data_points_per_forecast=10
),
developer_velocity_decimator=DeveloperVelocityDecimator(
max_amount_of_data_points_per_velocity=10
),
)

authentication_business_logic = AuthenticationBusinessLogic(
path_to_accounts_yml_file=str(constants.PATH_TO_ACCOUNTS_YML_FILE),
)
Expand Down Expand Up @@ -114,15 +123,43 @@ async def get_dashboard_overview_page(request: Request):
return HTMLResponse(
content=make_dashboard_overview_page(
user_name=account.name,
# burn_down_warnings=[
# Alert(
# title="Rising Task Burn Down Estimation",
# description="Attention you have a rising Task Burn Down Estimation. "
# "Make sure this happened because of changes in scope."
# )
# ]
velocity_overview_chart_data_file_name=_get_velocity_overview_chart_data_file_name(
account=account,
),
burn_down_overview_chart_data_file_name=_get_total_task_burn_down_data_file_name(
account_id=account.id,
),
)
)


def _get_velocity_overview_chart_data_file_name(account: Account) -> str:
two_weeks_of_developer_velocity = (
developer_velocity_business_logic.get_developer_velocity(
account=account,
time_in_weeks=2,
)
)
two_weeks_of_average_developer_velocity = (
developer_velocity_business_logic.get_average_developer_velocity(
time_in_weeks=2,
)
)
tracking_start_date = Date.today().go_back_weeks(2)
chart_data = overview_chart_data_formatter.to_single_developer_velocity_chart_data(
developer_velocity=developer_velocity_business_logic.filter_velocity_before_given_start_date(
velocity=two_weeks_of_developer_velocity,
start_date=tracking_start_date,
),
average_developer_velocity=developer_velocity_business_logic.filter_velocity_before_given_start_date(
velocity=two_weeks_of_average_developer_velocity,
start_date=tracking_start_date,
),
)
return developer_velocity_business_logic.get_file_path_for_data(
data=dataclasses.asdict(chart_data),
account_id=account.id,
)


@private_app.get("/dashboard/velocity")
Expand Down Expand Up @@ -198,7 +235,7 @@ def _get_file_name_for_developer_velocity(
account_id: str,
tracking_start_date: Date,
) -> str:
chart_data = chart_data_formatter.to_single_developer_velocity_chart_data(
chart_data = detail_page_chart_data_formatter.to_single_developer_velocity_chart_data(
developer_velocity=developer_velocity_business_logic.filter_velocity_before_given_start_date(
velocity=developer_velocity,
start_date=tracking_start_date,
Expand All @@ -217,10 +254,7 @@ def _get_file_name_for_developer_velocity(
@private_app.get("/dashboard/burn-down")
async def get_dashboard_burn_down_page(request: Request):
account = _unsafe_get_account_from_authentication_token_cookie(request)
burn_down_forcast = burn_down_business_logic.get_total_task_burn_down_data()
chart_data = chart_data_formatter.to_burn_down_chart_data(burn_down_forcast)
file_name = developer_velocity_business_logic.get_file_path_for_data(
data=dataclasses.asdict(chart_data),
file_name = _get_total_task_burn_down_data_file_name(
account_id=account.id,
)
burn_down_tasks: List[BurnDownPageTask] = []
Expand All @@ -233,7 +267,7 @@ async def get_dashboard_burn_down_page(request: Request):
)
if burn_down_forecast is None:
raise TaskNotFound(task_id=task.id)
chart_data_for_task = chart_data_formatter.to_burn_down_chart_data(
chart_data_for_task = detail_page_chart_data_formatter.to_burn_down_chart_data(
burn_down_forecast
)
chart_data_file_name = developer_velocity_business_logic.get_file_path_for_data(
Expand Down Expand Up @@ -268,6 +302,17 @@ async def get_dashboard_burn_down_page(request: Request):
)


def _get_total_task_burn_down_data_file_name(account_id: str) -> str:
burn_down_forcast = burn_down_business_logic.get_total_task_burn_down_data()
chart_data = detail_page_chart_data_formatter.to_burn_down_chart_data(
burn_down_forcast
)
return developer_velocity_business_logic.get_file_path_for_data(
data=dataclasses.asdict(chart_data),
account_id=account_id,
)


class TaskNotFound(ValueError, HTTPException):
def __init__(self, task_id: str):
super().__init__(f'No task was found for given task_id: "{task_id}".')
Expand Down
6 changes: 4 additions & 2 deletions web_interface/pages/make_dashboard_overview_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

def make_dashboard_overview_page(
user_name: str,
velocity_overview_chart_data_file_name: str,
burn_down_overview_chart_data_file_name: str,
velocity_warnings: Optional[List[Alert]] = None,
burn_down_warnings: Optional[List[Alert]] = None,
) -> str:
Expand All @@ -34,7 +36,7 @@ def make_dashboard_overview_page(
subtitle="An overview of the current developer velocity.",
children=[
make_chart_html(
data_file_name="./foobar-developer-velocity.json",
data_file_name=velocity_overview_chart_data_file_name,
chart_type="velocity",
),
make_warnings(warnings=velocity_warnings or []),
Expand All @@ -48,7 +50,7 @@ def make_dashboard_overview_page(
subtitle="An overview of the current task burn down estimation.",
children=[
make_chart_html(
data_file_name="./foobar-task-burn-down-metric.json",
data_file_name=burn_down_overview_chart_data_file_name,
chart_type="burn-down",
),
make_warnings(warnings=burn_down_warnings or []),
Expand Down

0 comments on commit b9d7a0c

Please sign in to comment.