Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Participants indicate their level of understanding (originally done plastic cups

🔴 Red → Cannot follow

The presenter sees an aggregate view of the responses and can adjust the lecture accordingly.
The presenter sees an aggregate view of the responses and can adjust the presentation accordingly.



Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "open_cups"
version = "0.1.0"
description = "Streamlit application for tracking lecture audience feedback"
description = "Streamlit application for tracking audience feedback"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
Expand Down
23 changes: 12 additions & 11 deletions src/open_cups/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def show_room_selection_screen(lobby: LobbyState) -> None:
"🟡 Yellow → Need more explanation \n"
"🔴 Red → Cannot follow\n\n"
"The presenter sees an aggregate view of the responses "
"and can adjust the lecture accordingly.",
"and can adjust the presentation accordingly.",
)

st.subheader("How to Use This App")
Expand Down Expand Up @@ -122,17 +122,25 @@ def show_room_selection_screen(lobby: LobbyState) -> None:
def show_user_status_selection(room: ClientState) -> None:
st.subheader("Your Status")
current_user_status = room.get_user_status()
st.markdown(
"""
<style>
div[data-testid="stRadio"] label {
padding: 6px;
}
</style>
""",
unsafe_allow_html=True,
)
Comment on lines +125 to +134
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, the radio buttons look weirdly compact next to the bar chart. And I don't want to reduce the bar chart's height.

status_options = [
UserStatus.GREEN,
UserStatus.YELLOW,
UserStatus.RED,
]
if current_user_status == UserStatus.UNKNOWN:
status_options.append(UserStatus.UNKNOWN)

index = status_options.index(current_user_status)
selected_user_status = st.radio(
"How well can you follow the lecture?",
"How well can you follow the presentation?",
status_options,
index=index,
format_func=lambda s: s.value,
Expand All @@ -141,13 +149,6 @@ def show_user_status_selection(room: ClientState) -> None:
)
room.set_user_status(selected_user_status)

has_user_transitioned_away_from_unknown_status = (
current_user_status == UserStatus.UNKNOWN
and selected_user_status != UserStatus.UNKNOWN
)
if has_user_transitioned_away_from_unknown_status:
st.rerun()


def generate_qr_code_image(room_id: str) -> bytes:
base_url = st.context.url
Expand Down
2 changes: 1 addition & 1 deletion src/open_cups/application_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def join_room(self, room_id: str, session_id: str) -> None:
if room_id not in self.rooms:
message = f"Room {room_id} does not exist"
raise ValueError(message)
self.rooms[room_id].set_session_status(session_id, UserStatus.UNKNOWN)
self.rooms[room_id].set_session_status(session_id, UserStatus.GREEN)

def remove_rooms_with_inactive_hosts(self, timeout_seconds: int) -> None:
inactive_room_ids = [
Expand Down
1 change: 0 additions & 1 deletion src/open_cups/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
GREEN_COLOR = "#10B981"

ORDERED_STATUS_COLOR_MAP = [
(UserStatus.UNKNOWN, GREY_COLOR),
(UserStatus.RED, RED_COLOR),
(UserStatus.YELLOW, YELLOW_COLOR),
(UserStatus.GREEN, GREEN_COLOR),
Expand Down
1 change: 0 additions & 1 deletion src/open_cups/stats_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def create_snapshot(user_sessions: Iterable[UserSession]) -> StatusSnapshot:
UserStatus.GREEN: 0,
UserStatus.YELLOW: 0,
UserStatus.RED: 0,
UserStatus.UNKNOWN: 0,
},
)

Expand Down
2 changes: 0 additions & 2 deletions src/open_cups/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@


class UserStatus(Enum):
UNKNOWN = "Unknown"
GREEN = "🟢 Green"
YELLOW = "🟡 Yellow"
RED = "🔴 Red"

def caption(self) -> str:
captions = {
UserStatus.UNKNOWN: "Not decided yet",
UserStatus.GREEN: "Following easily",
UserStatus.YELLOW: "Need more explanation",
UserStatus.RED: "Cannot follow",
Expand Down
4 changes: 2 additions & 2 deletions tests/bdd/features/multiple_session.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Feature: Multiple sessions
When a second user wants to join with invalid URL
Then the second user should see warning message "Room ID from URL not found"
When a third user wants to join with my room URL
Then "me, third_user" should see status "Unknown"
Then "me, third_user" should see status "🟢 Green"

Scenario: Two users in one room share statistics
Given I host a room
When a second user joins the room
Then "me, second_user" should see status "Unknown"
Then "me, second_user" should see status "🟢 Green"
When the second user selects the status "<status>"
Then "me, second_user" should see status "<status>"
Examples:
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_stats_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def test_status_history_snapshot_interval(mock_time: MockTime) -> None:
assert history[0].counts[UserStatus.GREEN] == 1
assert history[0].counts[UserStatus.YELLOW] == 1
assert history[0].counts[UserStatus.RED] == 0
assert history[0].counts[UserStatus.UNKNOWN] == 0

mock_time.current_time = 11.0
unit.record_status_snapshot(
Expand Down
Loading