Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display keys to list #1693

Merged
merged 1 commit into from
May 19, 2022
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
3 changes: 3 additions & 0 deletions backend/systembridgebackend/modules/display/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ async def update_resolution_vertical(

async def update_all_data(self) -> None:
"""Update data"""
display_list = []
for display_name in self._display.get_displays(self._database):
display_key = make_key(display_name)
display_list.append(display_key)
await asyncio.gather(
*[
self.update_name(display_key, display_name),
Expand All @@ -84,3 +86,4 @@ async def update_all_data(self) -> None:
self.update_resolution_vertical(display_key),
]
)
self._database.write("display", "displays", str(display_list))
14 changes: 13 additions & 1 deletion connector/systembridgeconnector/models/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
from pydantic import BaseModel, Extra, Field


class LastUpdated(BaseModel):
"""
Last updated
"""

class Config:
extra = Extra.allow

displays: float


class Display(BaseModel):
"""
Display
Expand All @@ -14,4 +25,5 @@ class Display(BaseModel):
class Config:
extra = Extra.allow

last_updated: dict[str, float] = Field(..., description="Last updated")
displays: list
last_updated: LastUpdated = Field(..., description="Last updated")
8 changes: 8 additions & 0 deletions schemas/data/display.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
"type": "object",
"description": "Display",
"properties": {
"displays": {
"type": "array"
},
"last_updated": {
"type": "object",
"description": "Last updated",
"properties": {
"displays": {
"type": "number"
}
},
"additionalProperties": {
"type": "number"
}
Expand Down
14 changes: 13 additions & 1 deletion shared/systembridgeshared/models/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
from pydantic import BaseModel, Extra, Field


class LastUpdated(BaseModel):
"""
Last updated
"""

class Config:
extra = Extra.allow

displays: float


class Display(BaseModel):
"""
Display
Expand All @@ -14,4 +25,5 @@ class Display(BaseModel):
class Config:
extra = Extra.allow

last_updated: dict[str, float] = Field(..., description="Last updated")
displays: list
last_updated: LastUpdated = Field(..., description="Last updated")