Skip to content

Commit

Permalink
added dates in overview
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanderLaan committed Nov 12, 2024
1 parent c59a77c commit d4fd6df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pandas as pd
import plotly.graph_objects as go
import streamlit as st
from datetime import datetime, timedelta

def update_user_csv(username, week_numbers, selected_category, notes):
# Define the file path based on the username
Expand Down Expand Up @@ -226,7 +227,7 @@ def create_week_planning_team(week_number, employees_list):
return df_current_week, bad_employees

# makes plotly bar chart of employees work planning overview for selected week
def create_overview_graph(df__week, week_number):
def create_overview_graph(df__week, week_number, startday_week):
# Create Horizontal bar chart
values = ["Afwezig", "Heel Rustig", "Rustig", "Goed", "Druk", "Heel druk"]

Expand All @@ -245,8 +246,11 @@ def create_overview_graph(df__week, week_number):
) # give bar of every person a specific color based on drukte

# Customize the layout (optional)
endday_week = startday_week + timedelta(days=5)
endday_week = endday_week.strftime("%d-%m-%Y")
startday_week = startday_week.strftime("%d-%m-%Y")
fig.update_layout(
title=f"Work in monitoring - weeknummer {week_number}",
title=f"Work in Monitoring - weeknummer {week_number} - from {startday_week} until {endday_week}",
xaxis=dict(
title="",
side="top", # put x-asis on top of plot
Expand Down
6 changes: 4 additions & 2 deletions wim.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,9 @@ def read_yaml():
current_week_number, employees_list
)
# print(current_week_planning)
default_start = today -timedelta(days=today.weekday())
graph_current_week = create_overview_graph(
current_week_planning, current_week_number
current_week_planning, current_week_number, default_start
)

# place graphic on right spot
Expand Down Expand Up @@ -219,10 +220,11 @@ def read_yaml():

with tab2:
next_week_number = datetime.now().isocalendar()[1] + 1
start_day_next_week = default_start + timedelta(days=7)
next_week_planning, bad_employees = create_week_planning_team(
next_week_number, employees_list
)
graph_next_week = create_overview_graph(next_week_planning, next_week_number)
graph_next_week = create_overview_graph(next_week_planning, next_week_number, start_day_next_week)

# place graph or next week planning on right spot

Expand Down

0 comments on commit d4fd6df

Please sign in to comment.