Skip to content

Commit

Permalink
Merge pull request #66 from TUMFARSynchrony/frontend-my-redux-refacto…
Browse files Browse the repository at this point in the history
…ring

Redux refactoring and introduce participant name
  • Loading branch information
mertyldrr authored Jul 11, 2023
2 parents b584cb6 + c58b7c3 commit 63aa439
Show file tree
Hide file tree
Showing 46 changed files with 1,132 additions and 936 deletions.
9 changes: 7 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.organizeImports": true
},

"[python]": {
"files.trimTrailingWhitespace": true,
"editor.defaultFormatter": null,
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.insertSpaces": true,
"editor.rulers": [88], // Black line witdh. See https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length
"editor.formatOnSave": true
},
"python.formatting.provider": "black",
"python.analysis.typeCheckingMode": "basic",
"python.analysis.typeCheckingMode": "basic"
}
16 changes: 5 additions & 11 deletions backend/session/data/participant/participant_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class ParticipantData(BaseData):
Attributes
----------
id : str
first_name : str
last_name : str
participant_name : str
banned : bool
size : SizeData
muted_video : bool
Expand All @@ -54,11 +53,8 @@ class ParticipantData(BaseData):
id: str
"""Participant ID."""

first_name: str
"""First name of this participant."""

last_name: str
"""Last name of this participant."""
participant_name: str
"""Name of this participant."""

banned: bool = field(repr=False)
"""Whether this participant is banned."""
Expand Down Expand Up @@ -117,8 +113,7 @@ def asdict(self) -> ParticipantDict:
"""
return {
"id": self.id,
"first_name": self.first_name,
"last_name": self.last_name,
"participant_name": self.participant_name,
"banned": self.banned,
"size": self.size.asdict(),
"muted_video": self.muted_video,
Expand All @@ -138,8 +133,7 @@ def as_summary_dict(self) -> ParticipantSummaryDict:
ParticipantSummaryDict with some of the data in this ParticipantData.
"""
return {
"first_name": self.first_name,
"last_name": self.last_name,
"participant_name": self.participant_name,
"size": self.size.asdict(),
"position": self.position.asdict(),
"chat": self.chat,
Expand Down
3 changes: 1 addition & 2 deletions backend/session/data/participant/participant_data_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def participant_data_factory(participant_dict: ParticipantDict) -> ParticipantDa
positionData = PositionData(pos["x"], pos["y"], pos["z"])
return ParticipantData(
participant_dict["id"],
participant_dict["first_name"],
participant_dict["last_name"],
participant_dict["participant_name"],
participant_dict["banned"],
sizeData,
participant_dict["muted_video"],
Expand Down
9 changes: 3 additions & 6 deletions backend/session/data/participant/participant_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ class ParticipantDict(TypedDict):
id: str, default ""
Unique id for this participant in a Session. When creating a new Participant in
a Session, this field is initially set to an empty string.
first_name : str
First name of the participant.
last_name : str
Last name of the participant.
participant_name : str
Name of the participant.
muted_video : bool
Whether the participants' video is forcefully muted by the experimenter.
muted_audio : bool
Expand Down Expand Up @@ -51,8 +49,7 @@ class ParticipantDict(TypedDict):
"""

id: str
first_name: str
last_name: str
participant_name: str
muted_video: bool
muted_audio: bool
audio_filters: list[FilterDict]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ def is_valid_participant(data, recursive: bool = True) -> TypeGuard[ParticipantD

return (
isinstance(data["id"], str)
and isinstance(data["first_name"], str)
and isinstance(data["last_name"], str)
and isinstance(data["participant_name"], str)
and isinstance(data["muted_video"], bool)
and isinstance(data["muted_audio"], bool)
and isinstance(data["banned"], bool)
Expand Down
9 changes: 3 additions & 6 deletions backend/session/data/participant/participant_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ class ParticipantSummaryDict(TypedDict):
Attributes
----------
first_name : str
First name of the participant.
last_name : str
Last name of the participant.
participant_name : str
Name of the participant.
position : custom_types.position.PositionDict
Position of the participant's stream on the canvas.
size : custom_types.size_types.SizeDict
Expand All @@ -40,8 +38,7 @@ class ParticipantSummaryDict(TypedDict):
https://github.com/TUMFARSynchorny/experimental-hub/wiki/Data-Types#participantsummary
"""

first_name: str
last_name: str
participant_name: str
position: PositionDict
size: SizeDict
chat: list[ChatMessageDict]
233 changes: 114 additions & 119 deletions backend/sessions/ae839e5e6f.json
Original file line number Diff line number Diff line change
@@ -1,128 +1,123 @@
{
"id": "ae839e5e6f",
"title": "Example Session 1",
"date": 1650380763073,
"record": false,
"time_limit": 1800000,
"description": "Example description with 250 words and 1506 characters: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum",
"creation_time": 0,
"end_time": 1684691314078,
"start_time": 1684691314078,
"notes": [
"id": "ae839e5e6f",
"title": "Example Session 1",
"date": 1650380763073,
"record": false,
"time_limit": 1800000,
"description": "Example description with 250 words and 1506 characters: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum",
"creation_time": 0,
"end_time": 1684691314078,
"start_time": 1684691314078,
"notes": [
{
"time": 1650380763076,
"speakers": ["speaker"],
"content": "This is a note"
}
],
"participants": [
{
"id": "9ba5fdccde",
"participant_name": "Max",
"banned": false,
"size": {
"width": 100,
"height": 100
},
"muted_video": false,
"muted_audio": false,
"position": {
"x": 0,
"y": 10,
"z": 10
},
"chat": [
{
"time": 1650380763076,
"speakers": [
"speaker"
],
"content": "This is a note"
"message": "Welcome to todays experiment!",
"time": 1650380763075,
"author": "experimenter",
"target": "participants"
}
],
"participants": [
],
"audio_filters": [],
"video_filters": []
},
{
"id": "25a882669d",
"participant_name": "Erika",
"banned": false,
"size": {
"width": 100,
"height": 100
},
"muted_video": false,
"muted_audio": true,
"position": {
"x": 0,
"y": 150,
"z": 200
},
"chat": [
{
"id": "9ba5fdccde",
"first_name": "Max",
"last_name": "Mustermann",
"banned": false,
"size": {
"width": 100,
"height": 100
},
"muted_video": false,
"muted_audio": false,
"position": {
"x": 0,
"y": 10,
"z": 10
},
"chat": [
{
"message": "Welcome to todays experiment!",
"time": 1650380763075,
"author": "experimenter",
"target": "participants"
}
],
"audio_filters": [],
"video_filters": []
"message": "Welcome to todays experiment!",
"time": 1650380763075,
"author": "experimenter",
"target": "participants"
},
{
"id": "25a882669d",
"first_name": "Erika",
"last_name": "Mustermann",
"banned": false,
"size": {
"width": 100,
"height": 100
},
"muted_video": false,
"muted_audio": true,
"position": {
"x": 0,
"y": 150,
"z": 200
},
"chat": [
{
"message": "Welcome to todays experiment!",
"time": 1650380763075,
"author": "experimenter",
"target": "participants"
},
{
"message": "Hello Erika. Please enable your video camera to start the experiment.",
"time": 1650380764175,
"author": "experimenter",
"target": "25a882669d"
},
{
"message": "Hello, of course. It should work now.",
"time": 1650380765075,
"author": "25a882669d",
"target": "experimenter"
}
],
"audio_filters": [],
"video_filters": []
"message": "Hello Erika. Please enable your video camera to start the experiment.",
"time": 1650380764175,
"author": "experimenter",
"target": "25a882669d"
},
{
"id": "8e39086e83",
"first_name": "Bob",
"last_name": "Builder",
"banned": false,
"size": {
"width": 100,
"height": 100
},
"muted_video": true,
"muted_audio": true,
"position": {
"x": 0,
"y": 300,
"z": 250
},
"chat": [
{
"message": "Welcome to todays experiment!",
"time": 1650380763075,
"author": "experimenter",
"target": "participants"
},
{
"message": "Hello World!",
"time": 1650380765075,
"author": "8e39086e83",
"target": "experimenter"
},
{
"message": "Lets build the experimental hub!",
"time": 1650380765075,
"author": "8e39086e83",
"target": "experimenter"
}
],
"audio_filters": [],
"video_filters": []
"message": "Hello, of course. It should work now.",
"time": 1650380765075,
"author": "25a882669d",
"target": "experimenter"
}
],
"log": []
}
],
"audio_filters": [],
"video_filters": []
},
{
"id": "8e39086e83",
"participant_name": "Bob",
"banned": false,
"size": {
"width": 100,
"height": 100
},
"muted_video": true,
"muted_audio": true,
"position": {
"x": 0,
"y": 300,
"z": 250
},
"chat": [
{
"message": "Welcome to todays experiment!",
"time": 1650380763075,
"author": "experimenter",
"target": "participants"
},
{
"message": "Hello World!",
"time": 1650380765075,
"author": "8e39086e83",
"target": "experimenter"
},
{
"message": "Lets build the experimental hub!",
"time": 1650380765075,
"author": "8e39086e83",
"target": "experimenter"
}
],
"audio_filters": [],
"video_filters": []
}
],
"log": []
}
Loading

0 comments on commit 63aa439

Please sign in to comment.