James McCool
commited on
Commit
·
cbe8e8b
1
Parent(s):
33348fa
More updates to the projections manager tab
Browse files
app.py
CHANGED
|
@@ -1804,7 +1804,6 @@ if selected_tab == 'Projections Management':
|
|
| 1804 |
),
|
| 1805 |
'position': st.column_config.TextColumn(
|
| 1806 |
'Position',
|
| 1807 |
-
disabled=True,
|
| 1808 |
width='small'
|
| 1809 |
),
|
| 1810 |
'team': st.column_config.TextColumn(
|
|
@@ -1813,7 +1812,6 @@ if selected_tab == 'Projections Management':
|
|
| 1813 |
),
|
| 1814 |
'salary': st.column_config.NumberColumn(
|
| 1815 |
'Salary',
|
| 1816 |
-
disabled=True,
|
| 1817 |
width='small',
|
| 1818 |
format='$%d'
|
| 1819 |
),
|
|
@@ -1876,7 +1874,7 @@ if selected_tab == 'Projections Management':
|
|
| 1876 |
# Check for changes and update
|
| 1877 |
if not edited_df.equals(filtered_df):
|
| 1878 |
# Find which rows changed
|
| 1879 |
-
changed_mask = ~(edited_df[['team', 'median', 'ownership', 'captain ownership']] == filtered_df[['team', 'median', 'ownership', 'captain ownership']]).all(axis=1)
|
| 1880 |
changed_rows = edited_df[changed_mask]
|
| 1881 |
|
| 1882 |
if len(changed_rows) > 0:
|
|
@@ -1888,7 +1886,9 @@ if selected_tab == 'Projections Management':
|
|
| 1888 |
orig_idx = st.session_state['projections_df'][st.session_state['projections_df']['player_names'] == player_name].index
|
| 1889 |
if len(orig_idx) > 0:
|
| 1890 |
# Player exists in projections_df - update existing row
|
|
|
|
| 1891 |
st.session_state['projections_df'].loc[orig_idx[0], 'team'] = row['team']
|
|
|
|
| 1892 |
st.session_state['projections_df'].loc[orig_idx[0], 'median'] = row['median']
|
| 1893 |
st.session_state['projections_df'].loc[orig_idx[0], 'ownership'] = row['ownership']
|
| 1894 |
st.session_state['projections_df'].loc[orig_idx[0], 'captain ownership'] = row['captain ownership']
|
|
@@ -1908,6 +1908,8 @@ if selected_tab == 'Projections Management':
|
|
| 1908 |
# Update map_dict entries
|
| 1909 |
if 'map_dict' in st.session_state:
|
| 1910 |
st.session_state['map_dict']['team_map'][player_name] = str(row['team'])
|
|
|
|
|
|
|
| 1911 |
st.session_state['map_dict']['proj_map'][player_name] = float(row['median'])
|
| 1912 |
st.session_state['map_dict']['own_map'][player_name] = float(row['ownership'])
|
| 1913 |
|
|
|
|
| 1804 |
),
|
| 1805 |
'position': st.column_config.TextColumn(
|
| 1806 |
'Position',
|
|
|
|
| 1807 |
width='small'
|
| 1808 |
),
|
| 1809 |
'team': st.column_config.TextColumn(
|
|
|
|
| 1812 |
),
|
| 1813 |
'salary': st.column_config.NumberColumn(
|
| 1814 |
'Salary',
|
|
|
|
| 1815 |
width='small',
|
| 1816 |
format='$%d'
|
| 1817 |
),
|
|
|
|
| 1874 |
# Check for changes and update
|
| 1875 |
if not edited_df.equals(filtered_df):
|
| 1876 |
# Find which rows changed
|
| 1877 |
+
changed_mask = ~(edited_df[['position', 'team', 'salary', 'median', 'ownership', 'captain ownership']] == filtered_df[['position', 'team', 'salary', 'median', 'ownership', 'captain ownership']]).all(axis=1)
|
| 1878 |
changed_rows = edited_df[changed_mask]
|
| 1879 |
|
| 1880 |
if len(changed_rows) > 0:
|
|
|
|
| 1886 |
orig_idx = st.session_state['projections_df'][st.session_state['projections_df']['player_names'] == player_name].index
|
| 1887 |
if len(orig_idx) > 0:
|
| 1888 |
# Player exists in projections_df - update existing row
|
| 1889 |
+
st.session_state['projections_df'].loc[orig_idx[0], 'position'] = row['position']
|
| 1890 |
st.session_state['projections_df'].loc[orig_idx[0], 'team'] = row['team']
|
| 1891 |
+
st.session_state['projections_df'].loc[orig_idx[0], 'salary'] = row['salary']
|
| 1892 |
st.session_state['projections_df'].loc[orig_idx[0], 'median'] = row['median']
|
| 1893 |
st.session_state['projections_df'].loc[orig_idx[0], 'ownership'] = row['ownership']
|
| 1894 |
st.session_state['projections_df'].loc[orig_idx[0], 'captain ownership'] = row['captain ownership']
|
|
|
|
| 1908 |
# Update map_dict entries
|
| 1909 |
if 'map_dict' in st.session_state:
|
| 1910 |
st.session_state['map_dict']['team_map'][player_name] = str(row['team'])
|
| 1911 |
+
st.session_state['map_dict']['pos_map'][player_name] = str(row['position'])
|
| 1912 |
+
st.session_state['map_dict']['salary_map'][player_name] = int(row['salary'])
|
| 1913 |
st.session_state['map_dict']['proj_map'][player_name] = float(row['median'])
|
| 1914 |
st.session_state['map_dict']['own_map'][player_name] = float(row['ownership'])
|
| 1915 |
|