Skip to content

Commit

Permalink
Fixed split stages in ScheduledProject
Browse files Browse the repository at this point in the history
  • Loading branch information
StannisMod committed Nov 15, 2023
1 parent d6f176c commit 3639235
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sampo"
version = "0.1.1.247"
version = "0.1.1.249"
description = "Open-source framework for adaptive manufacturing processes scheduling"
authors = ["iAirLab <[email protected]>"]
license = "BSD-3-Clause"
Expand Down
9 changes: 7 additions & 2 deletions sampo/schemas/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,17 @@ def merged_stages_datetime_df(self, offset: Union[datetime, str]) -> DataFrame:

def unite_stages(self) -> 'Schedule':
merged_df = fix_split_tasks(self._schedule)
for _, row in merged_df.iterrows():

def f(row):
swork: ScheduledWork = deepcopy(row[self._scheduled_work_column])
row[self._scheduled_work_column] = swork
swork.name = row['task_name']
swork.name = row['task_name_mapped']
swork.display_name = row['task_name']
swork.volume = float(row['volume'])
swork.start_end_time = Time(int(row['start'])), Time(int(row['finish']))
return row

merged_df = merged_df.apply(f, axis=1)

return Schedule.from_scheduled_works(works=merged_df[self._scheduled_work_column])

Expand Down
2 changes: 1 addition & 1 deletion sampo/utilities/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def merge_split_stages(task_df: pd.DataFrame) -> pd.Series:
df = task_df.copy()

df = df.iloc[-1:].reset_index(drop=True)
for column in ['task_id', 'task_name']:
for column in ['task_id', 'task_name', 'task_name_mapped']:
df.loc[0, column] = df.loc[0, column].split(STAGE_SEP)[0] # fix task id and name

# sum up volumes through all stages
Expand Down

0 comments on commit 3639235

Please sign in to comment.