Skip to content

Commit

Permalink
Merge pull request #22 from Carifio24/hubble-class-request
Browse files Browse the repository at this point in the history
Specify story in class creation request
  • Loading branch information
Carifio24 authored Dec 4, 2024
2 parents 6df0e0b + be78595 commit 69eac49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/cds_portal/pages/manage_classes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@
from ...remote import BASE_API


# If we want to remove more characters in the future
# (or replace more with underscores)
# switch to using re.sub
def format_story_name(name: str):
return name.lower().replace("'", "").replace(" ", "_")


@solara.component
def CreateClassDialog(on_create_clicked: callable = None):
active, set_active = solara.use_state(False) #
text, set_text = solara.use_state("")
stories, set_stories = solara.use_state([])
stories, set_stories = solara.use_state("")
expected_size, set_expected_size = solara.use_state(20)
asynchronous, set_asynchronous = solara.use_state(False)
expected_size_error = solara.use_reactive(False)
Expand Down Expand Up @@ -92,6 +99,7 @@ def _add_button_clicked(*args):
"stories": f"{', '.join(stories)}",
"expected_size": expected_size,
"asynchronous": asynchronous,
"story_name": format_story_name(stories),
}
)
set_active(False)
Expand Down
1 change: 1 addition & 0 deletions src/cds_portal/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def create_new_class(self, info: dict) -> dict:
"name": info["name"],
"expected_size": info["expected_size"],
"asynchronous": info["asynchronous"],
"story_name": info["story_name"],
},
)

Expand Down

0 comments on commit 69eac49

Please sign in to comment.