From e56a35b1549ca5762f559d08ec59b7e05e4c14d9 Mon Sep 17 00:00:00 2001 From: dingo Date: Wed, 25 Mar 2026 14:00:06 -0400 Subject: [PATCH] Bazaar and leaderboard bug fixes --- Client/origin-client/autoloads/Network.gd | 4 +- .../bazaar/components/store_item_row.gd | 12 +- .../scenes/leaderboard/LeaderboardScreen.tscn | 70 +++---- .../scenes/leaderboard/leaderboard_screen.gd | 181 ++++++++++++++++-- .../origin-client/scenes/main/MainScreen.tscn | 69 ++++--- .../Handlers/BazaarGetStoreHandler.cs | 2 +- 6 files changed, 243 insertions(+), 95 deletions(-) diff --git a/Client/origin-client/autoloads/Network.gd b/Client/origin-client/autoloads/Network.gd index 040f14d..d77086a 100644 --- a/Client/origin-client/autoloads/Network.gd +++ b/Client/origin-client/autoloads/Network.gd @@ -231,8 +231,10 @@ func _poll_packets() -> void: print("[Net] << %s" % text) var parsed: Variant = JSON.parse_string(text) + #print("[Parsed Type] ", type_string(typeof(parsed))) if typeof(parsed) != TYPE_DICTIONARY: - push_warning("Network: non-object packet — %s" % text) + if (parsed != null): + push_warning("Network: non-object packet — %s" % text) continue _dispatch(parsed as Dictionary) diff --git a/Client/origin-client/scenes/bazaar/components/store_item_row.gd b/Client/origin-client/scenes/bazaar/components/store_item_row.gd index 2f3551c..141b3ed 100644 --- a/Client/origin-client/scenes/bazaar/components/store_item_row.gd +++ b/Client/origin-client/scenes/bazaar/components/store_item_row.gd @@ -22,13 +22,13 @@ var _item: Dictionary = {} func setup(item: Dictionary, fallback_art: String = "") -> void: _item = item - + print(item) name_label.text = item.get("name", "—") var desc: String = item.get("description", "") desc_label.text = desc desc_label.visible = not desc.is_empty() - + var sub := "" if item.has("totalSlots"): sub = "%d cards per pack" % int(item.get("totalSlots", 0)) @@ -60,7 +60,13 @@ func setup(item: Dictionary, fallback_art: String = "") -> void: buy_btn.pressed.connect(func(): buy_pressed.emit(_item)) - _load_art(item.get("imageCdnUrl", item.get("previewImageCdnUrl", "")), fallback_art) + var imageCdnUrl : Variant = item.get("imageCdnUrl") + var previewImageCdnUrl : Variant = item.get("previewImageCdnUrl") + if (imageCdnUrl == null): + imageCdnUrl = fallback_art + if (previewImageCdnUrl == null): + previewImageCdnUrl = fallback_art + _load_art(imageCdnUrl, previewImageCdnUrl) # -- Marketplace listing setup ------------------------------------------------- diff --git a/Client/origin-client/scenes/leaderboard/LeaderboardScreen.tscn b/Client/origin-client/scenes/leaderboard/LeaderboardScreen.tscn index 8a12dcb..e366ab8 100644 --- a/Client/origin-client/scenes/leaderboard/LeaderboardScreen.tscn +++ b/Client/origin-client/scenes/leaderboard/LeaderboardScreen.tscn @@ -1,6 +1,6 @@ -[gd_scene load_steps=2 format=3] +[gd_scene load_steps=2 format=3 uid="uid://g4uti1ufgc7i"] -[ext_resource type="Script" path="res://scenes/leaderboard/leaderboard_screen.gd" id="1_lb"] +[ext_resource type="Script" uid="uid://blb4o22kdgh5r" path="res://scenes/leaderboard/leaderboard_screen.gd" id="1_lb"] [node name="LeaderboardScreen" type="Control"] layout_mode = 3 @@ -18,7 +18,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -color = Color(0.094, 0.094, 0.137, 1.0) +color = Color(0.094, 0.094, 0.137, 1) [node name="Layout" type="VBoxContainer" parent="."] layout_mode = 1 @@ -32,28 +32,28 @@ theme_override_constants/separation = 0 [node name="TopBar" type="MarginContainer" parent="Layout"] layout_mode = 2 theme_override_constants/margin_left = 16 -theme_override_constants/margin_right = 16 theme_override_constants/margin_top = 8 +theme_override_constants/margin_right = 16 theme_override_constants/margin_bottom = 8 [node name="TopBarInner" type="HBoxContainer" parent="Layout/TopBar"] -layout_mode = 2 custom_minimum_size = Vector2(0, 40) +layout_mode = 2 theme_override_constants/separation = 10 [node name="BackBtn" type="Button" parent="Layout/TopBar/TopBarInner"] unique_name_in_owner = true -layout_mode = 2 custom_minimum_size = Vector2(40, 40) -text = "←" +layout_mode = 2 theme_override_font_sizes/font_size = 18 +text = "←" [node name="TitleLabel" type="Label" parent="Layout/TopBar/TopBarInner"] layout_mode = 2 size_flags_horizontal = 3 +theme_override_font_sizes/font_size = 18 text = "Leaderboard" vertical_alignment = 1 -theme_override_font_sizes/font_size = 18 [node name="HSep" type="HSeparator" parent="Layout"] layout_mode = 2 @@ -61,8 +61,8 @@ layout_mode = 2 [node name="HeaderRow" type="MarginContainer" parent="Layout"] layout_mode = 2 theme_override_constants/margin_left = 20 -theme_override_constants/margin_right = 20 theme_override_constants/margin_top = 8 +theme_override_constants/margin_right = 20 theme_override_constants/margin_bottom = 4 [node name="HeaderInner" type="HBoxContainer" parent="Layout/HeaderRow"] @@ -70,27 +70,27 @@ layout_mode = 2 theme_override_constants/separation = 12 [node name="RankHeader" type="Label" parent="Layout/HeaderRow/HeaderInner"] -layout_mode = 2 +modulate = Color(0.6, 0.6, 0.65, 1) custom_minimum_size = Vector2(48, 0) -horizontal_alignment = 1 -text = "Rank" -modulate = Color(0.6, 0.6, 0.65, 1.0) +layout_mode = 2 theme_override_font_sizes/font_size = 11 +text = "Rank" +horizontal_alignment = 1 [node name="NameHeader" type="Label" parent="Layout/HeaderRow/HeaderInner"] +modulate = Color(0.6, 0.6, 0.65, 1) layout_mode = 2 size_flags_horizontal = 3 -text = "Player" -modulate = Color(0.6, 0.6, 0.65, 1.0) theme_override_font_sizes/font_size = 11 +text = "Player" [node name="ScoreHeader" type="Label" parent="Layout/HeaderRow/HeaderInner"] -layout_mode = 2 +modulate = Color(0.6, 0.6, 0.65, 1) custom_minimum_size = Vector2(80, 0) -horizontal_alignment = 2 -text = "Score" -modulate = Color(0.6, 0.6, 0.65, 1.0) +layout_mode = 2 theme_override_font_sizes/font_size = 11 +text = "Score" +horizontal_alignment = 2 [node name="HSep2" type="HSeparator" parent="Layout"] layout_mode = 2 @@ -104,47 +104,47 @@ horizontal_scroll_mode = 0 layout_mode = 2 size_flags_horizontal = 3 theme_override_constants/margin_left = 20 -theme_override_constants/margin_right = 20 theme_override_constants/margin_top = 8 +theme_override_constants/margin_right = 20 theme_override_constants/margin_bottom = 8 +[node name="LoadingLabel" type="Label" parent="Layout/Scroll/ListMargin"] +unique_name_in_owner = true +modulate = Color(0.7, 0.7, 0.75, 1) +layout_mode = 2 +theme_override_font_sizes/font_size = 14 +text = "Loading…" + [node name="EntryList" type="VBoxContainer" parent="Layout/Scroll/ListMargin"] unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 theme_override_constants/separation = 4 -[node name="LoadingLabel" type="Label" parent="Layout/Scroll/ListMargin/EntryList"] -unique_name_in_owner = true -layout_mode = 2 -text = "Loading…" -modulate = Color(0.7, 0.7, 0.75, 1.0) -theme_override_font_sizes/font_size = 14 - [node name="PaginationRow" type="HBoxContainer" parent="Layout"] -layout_mode = 2 custom_minimum_size = Vector2(0, 44) -alignment = 1 +layout_mode = 2 theme_override_constants/separation = 12 +alignment = 1 [node name="PrevBtn" type="Button" parent="Layout/PaginationRow"] unique_name_in_owner = true -layout_mode = 2 custom_minimum_size = Vector2(80, 34) -text = "← Prev" +layout_mode = 2 theme_override_font_sizes/font_size = 13 +text = "← Prev" [node name="PageLabel" type="Label" parent="Layout/PaginationRow"] unique_name_in_owner = true +modulate = Color(0.7, 0.7, 0.75, 1) layout_mode = 2 +theme_override_font_sizes/font_size = 13 text = "Page 1 / 1" vertical_alignment = 1 -modulate = Color(0.7, 0.7, 0.75, 1.0) -theme_override_font_sizes/font_size = 13 [node name="NextBtn" type="Button" parent="Layout/PaginationRow"] unique_name_in_owner = true -layout_mode = 2 custom_minimum_size = Vector2(80, 34) -text = "Next →" +layout_mode = 2 theme_override_font_sizes/font_size = 13 +text = "Next →" diff --git a/Client/origin-client/scenes/leaderboard/leaderboard_screen.gd b/Client/origin-client/scenes/leaderboard/leaderboard_screen.gd index fff958e..ea7264a 100644 --- a/Client/origin-client/scenes/leaderboard/leaderboard_screen.gd +++ b/Client/origin-client/scenes/leaderboard/leaderboard_screen.gd @@ -27,55 +27,183 @@ func _ready() -> void: # ── Loading ─────────────────────────────────────────────────────────────────── +#func _load_page(page: int) -> void: + #if not is_inside_tree(): + #return + #if not is_instance_valid(loading_lbl): + #print("Dead") + #return + #if not is_instance_valid(entry_list): + #print("ded") + #return +# + #_page = page + #loading_lbl.visible = true +# + #for c in entry_list.get_children(): + #if is_instance_valid(c): + #c.queue_free() +# + #Network.request( + #"leaderboard.get", + #{ "page": _page, "pageSize": PAGE_SIZE }, + #func(_type: String, p: Variant): + #if not is_instance_valid(self) or not is_inside_tree(): + #return + #_on_leaderboard_ok(p), + #func(_c: String, _m: String): + #if not is_instance_valid(self) or not is_inside_tree(): + #return + #if not is_instance_valid(loading_lbl): + #return + #loading_lbl.text = "Failed to load." + #loading_lbl.visible = true + #) func _load_page(page: int) -> void: + if not is_inside_tree(): + return + + var loading := _loading_label() + var list := _entry_list() + + if loading == null: + print("LoadingLabel missing in _load_page") + return + if list == null: + print("EntryList missing in _load_page") + return + _page = page - loading_lbl.visible = true - for c in entry_list.get_children(): + loading.visible = true + + for c in list.get_children(): c.queue_free() Network.request( "leaderboard.get", { "page": _page, "pageSize": PAGE_SIZE }, - func(_type: String, p: Variant): _on_leaderboard_ok(p), + func(_type: String, p: Variant): + if not is_instance_valid(self): + return + call_deferred("_on_leaderboard_ok", p), func(_c: String, _m: String): - loading_lbl.text = "Failed to load." + if not is_instance_valid(self): + return + call_deferred("_on_leaderboard_failed") ) - +#func _on_leaderboard_ok(p: Variant) -> void: + #print("[Leaderboard] rcvd: ", p) + #if not is_instance_valid(self) or not is_inside_tree(): + #return + #if not is_instance_valid(loading_lbl): + #print("dead here") + #return + #if not is_instance_valid(entry_list): + #print("dead over here") + #return +# + #loading_lbl.visible = false +# + #var d := p as Dictionary + #var entries: Array = d.get("entries", []) as Array + #_total = int(d.get("totalCount", 0)) + #_page_count = max(1, int(ceil(_total / float(PAGE_SIZE)))) +# + #_update_pagination() +# + #if entries.is_empty(): + #if is_instance_valid(loading_lbl): + #loading_lbl.text = "No players yet." + #loading_lbl.visible = true + #return +# + #for entry in entries: + #if not is_instance_valid(entry_list): + #return +# + #var e := entry as Dictionary + #var row := ROW.instantiate() + #entry_list.add_child(row) + #row.setup( + #int(e.get("rank", 0)), + #e.get("displayName", "???"), + #int(e.get("rankScore", 0)), + #e.get("accountId", "") == Auth.user_id, + #int(e.get("rank", 99)) <= 3 + #) func _on_leaderboard_ok(p: Variant) -> void: - if not is_instance_valid(self) or not is_inside_tree(): + + if not is_inside_tree(): return - loading_lbl.visible = false - var d := p as Dictionary - var entries : Array = d.get("entries", []) as Array - _total = int(d.get("totalCount", 0)) + + var loading := _loading_label() + var list := _entry_list() + + if loading == null: + print("LoadingLabel missing in _on_leaderboard_ok") + return + if list == null: + print("EntryList missing in _on_leaderboard_ok") + return + + loading.visible = false + + var d := p as Dictionary + var entries: Array = d.get("entries", []) + _total = int(d.get("totalCount", 0)) _page_count = max(1, int(ceil(_total / float(PAGE_SIZE)))) _update_pagination() if entries.is_empty(): - loading_lbl.text = "No players yet." - loading_lbl.visible = true + loading.text = "No players yet." + loading.visible = true return for entry in entries: + if typeof(entry) != TYPE_DICTIONARY: + continue + var e := entry as Dictionary var row := ROW.instantiate() - entry_list.add_child(row) + list.add_child(row) row.setup( int(e.get("rank", 0)), - e.get("displayName", "???"), + str(e.get("displayName", "???")), int(e.get("rankScore", 0)), - e.get("accountId", "") == Auth.user_id, + str(e.get("accountId", "")) == str(Auth.user_id), int(e.get("rank", 99)) <= 3 ) -func _update_pagination() -> void: - page_label.text = "Page %d / %d" % [_page + 1, _page_count] - prev_btn.disabled = _page <= 0 - next_btn.disabled = _page >= _page_count - 1 +func _on_leaderboard_failed() -> void: + if not is_inside_tree(): + return + var loading := _loading_label() + if loading == null: + print("LoadingLabel missing in _on_leaderboard_failed") + return + + loading.text = "Failed to load." + loading.visible = true + +#func _update_pagination() -> void: + #page_label.text = "Page %d / %d" % [_page + 1, _page_count] + #prev_btn.disabled = _page <= 0 + #next_btn.disabled = _page >= _page_count - 1 +func _update_pagination() -> void: + var page_lbl := _page_label() + var prev := _prev_button() + var next := _next_button() + + if page_lbl != null: + page_lbl.text = "Page %d / %d" % [_page + 1, _page_count] + if prev != null: + prev.disabled = _page <= 0 + if next != null: + next.disabled = _page >= _page_count - 1 func _go_page(p: int) -> void: _load_page(clamp(p, 0, _page_count - 1)) @@ -83,3 +211,18 @@ func _go_page(p: int) -> void: func _on_back() -> void: get_tree().change_scene_to_file("res://scenes/main/MainScreen.tscn") + +func _loading_label() -> Label: + return get_node_or_null("%LoadingLabel") as Label + +func _entry_list() -> VBoxContainer: + return get_node_or_null("%EntryList") as VBoxContainer + +func _page_label() -> Label: + return get_node_or_null("%PageLabel") as Label + +func _prev_button() -> Button: + return get_node_or_null("%PrevBtn") as Button + +func _next_button() -> Button: + return get_node_or_null("%NextBtn") as Button diff --git a/Client/origin-client/scenes/main/MainScreen.tscn b/Client/origin-client/scenes/main/MainScreen.tscn index 101aa92..f406de9 100644 --- a/Client/origin-client/scenes/main/MainScreen.tscn +++ b/Client/origin-client/scenes/main/MainScreen.tscn @@ -1,6 +1,6 @@ -[gd_scene load_steps=3 format=3] +[gd_scene load_steps=3 format=3 uid="uid://dfyan2sntbmwp"] -[ext_resource type="Script" path="res://scenes/main/main_screen.gd" id="1_main"] +[ext_resource type="Script" uid="uid://n8qjxx4qlim7" path="res://scenes/main/main_screen.gd" id="1_main"] [ext_resource type="PackedScene" path="res://scenes/bug_report/BugReportDialog.tscn" id="2_brd"] [node name="MainScreen" type="Control"] @@ -19,7 +19,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -color = Color(0.094, 0.094, 0.137, 1.0) +color = Color(0.094, 0.094, 0.137, 1) [node name="Layout" type="VBoxContainer" parent="."] layout_mode = 1 @@ -31,8 +31,8 @@ grow_vertical = 2 theme_override_constants/separation = 0 [node name="TopBar" type="HBoxContainer" parent="Layout"] -layout_mode = 2 custom_minimum_size = Vector2(0, 56) +layout_mode = 2 theme_override_constants/separation = 12 [node name="TopBarMargin" type="MarginContainer" parent="Layout/TopBar"] @@ -48,9 +48,8 @@ theme_override_constants/separation = 0 [node name="BrandLabel" type="Label" parent="Layout/TopBar/TopBarMargin/TopBarInner"] layout_mode = 2 -text = "ORIGIN" theme_override_font_sizes/font_size = 18 -size_flags_vertical = 4 +text = "ORIGIN" [node name="TopSpacer" type="Control" parent="Layout/TopBar/TopBarMargin/TopBarInner"] layout_mode = 2 @@ -58,11 +57,10 @@ size_flags_horizontal = 3 [node name="StatusLabel" type="Label" parent="Layout/TopBar/TopBarMargin/TopBarInner"] unique_name_in_owner = true +modulate = Color(0.3, 0.9, 0.4, 1) layout_mode = 2 -text = "● Online" -modulate = Color(0.3, 0.9, 0.4, 1.0) -size_flags_vertical = 4 theme_override_font_sizes/font_size = 13 +text = "● Online" [node name="Separator" type="HSeparator" parent="Layout"] layout_mode = 2 @@ -90,14 +88,14 @@ theme_override_constants/separation = 20 [node name="WelcomeLabel" type="Label" parent="Layout/Scroll/Content/ContentMargin/ContentInner"] unique_name_in_owner = true layout_mode = 2 -text = "Welcome!" theme_override_font_sizes/font_size = 24 +text = "Welcome!" [node name="NavSection" type="Label" parent="Layout/Scroll/Content/ContentMargin/ContentInner"] +modulate = Color(0.6, 0.6, 0.65, 1) layout_mode = 2 -text = "PLAY" -modulate = Color(0.6, 0.6, 0.65, 1.0) theme_override_font_sizes/font_size = 11 +text = "PLAY" [node name="NavButtons" type="VBoxContainer" parent="Layout/Scroll/Content/ContentMargin/ContentInner"] layout_mode = 2 @@ -105,37 +103,37 @@ theme_override_constants/separation = 10 [node name="CollectionBtn" type="Button" parent="Layout/Scroll/Content/ContentMargin/ContentInner/NavButtons"] unique_name_in_owner = true -layout_mode = 2 custom_minimum_size = Vector2(0, 52) -text = "My Collection" +layout_mode = 2 theme_override_font_sizes/font_size = 15 +text = "My Collection" [node name="BazaarBtn" type="Button" parent="Layout/Scroll/Content/ContentMargin/ContentInner/NavButtons"] unique_name_in_owner = true -layout_mode = 2 custom_minimum_size = Vector2(0, 52) -text = "Bazaar" +layout_mode = 2 theme_override_font_sizes/font_size = 15 +text = "Bazaar" [node name="MatchBtn" type="Button" parent="Layout/Scroll/Content/ContentMargin/ContentInner/NavButtons"] unique_name_in_owner = true -layout_mode = 2 custom_minimum_size = Vector2(0, 52) -text = "Find Match" +layout_mode = 2 theme_override_font_sizes/font_size = 15 +text = "Find Match" [node name="FreePlayBtn" type="Button" parent="Layout/Scroll/Content/ContentMargin/ContentInner/NavButtons"] unique_name_in_owner = true -layout_mode = 2 custom_minimum_size = Vector2(0, 52) -text = "Free Play" +layout_mode = 2 theme_override_font_sizes/font_size = 15 +text = "Free Play" [node name="SocialSection" type="Label" parent="Layout/Scroll/Content/ContentMargin/ContentInner"] +modulate = Color(0.6, 0.6, 0.65, 1) layout_mode = 2 -text = "COMMUNITY" -modulate = Color(0.6, 0.6, 0.65, 1.0) theme_override_font_sizes/font_size = 11 +text = "COMMUNITY" [node name="SocialButtons" type="VBoxContainer" parent="Layout/Scroll/Content/ContentMargin/ContentInner"] layout_mode = 2 @@ -143,16 +141,16 @@ theme_override_constants/separation = 10 [node name="LeaderboardBtn" type="Button" parent="Layout/Scroll/Content/ContentMargin/ContentInner/SocialButtons"] unique_name_in_owner = true -layout_mode = 2 custom_minimum_size = Vector2(0, 52) -text = "Leaderboard" +layout_mode = 2 theme_override_font_sizes/font_size = 15 +text = "Leaderboard" [node name="AccountSection" type="Label" parent="Layout/Scroll/Content/ContentMargin/ContentInner"] +modulate = Color(0.6, 0.6, 0.65, 1) layout_mode = 2 -text = "ACCOUNT" -modulate = Color(0.6, 0.6, 0.65, 1.0) theme_override_font_sizes/font_size = 11 +text = "ACCOUNT" [node name="AccountButtons" type="VBoxContainer" parent="Layout/Scroll/Content/ContentMargin/ContentInner"] layout_mode = 2 @@ -160,29 +158,29 @@ theme_override_constants/separation = 10 [node name="AccountBtn" type="Button" parent="Layout/Scroll/Content/ContentMargin/ContentInner/AccountButtons"] unique_name_in_owner = true -layout_mode = 2 custom_minimum_size = Vector2(0, 52) -text = "Account" +layout_mode = 2 theme_override_font_sizes/font_size = 15 +text = "Account" [node name="SettingsBtn" type="Button" parent="Layout/Scroll/Content/ContentMargin/ContentInner/AccountButtons"] unique_name_in_owner = true -layout_mode = 2 custom_minimum_size = Vector2(0, 52) -text = "Settings" +layout_mode = 2 theme_override_font_sizes/font_size = 15 +text = "Settings" [node name="ReportBugBtn" type="Button" parent="Layout/Scroll/Content/ContentMargin/ContentInner/AccountButtons"] unique_name_in_owner = true -layout_mode = 2 +modulate = Color(0.85, 0.85, 0.9, 0.7) custom_minimum_size = Vector2(0, 44) -text = "Report a Bug" -modulate = Color(0.85, 0.85, 0.90, 0.7) +layout_mode = 2 theme_override_font_sizes/font_size = 13 +text = "Report a Bug" [node name="BottomBar" type="HBoxContainer" parent="Layout"] -layout_mode = 2 custom_minimum_size = Vector2(0, 56) +layout_mode = 2 [node name="BottomMargin" type="MarginContainer" parent="Layout/BottomBar"] layout_mode = 2 @@ -193,10 +191,9 @@ theme_override_constants/margin_right = 16 [node name="LogoutBtn" type="Button" parent="Layout/BottomBar/BottomMargin"] unique_name_in_owner = true layout_mode = 2 -text = "Sign Out" theme_override_font_sizes/font_size = 14 +text = "Sign Out" [node name="BugReportDialog" parent="." instance=ExtResource("2_brd")] unique_name_in_owner = true visible = false - diff --git a/Server/src/SOR.Bazaar/Handlers/BazaarGetStoreHandler.cs b/Server/src/SOR.Bazaar/Handlers/BazaarGetStoreHandler.cs index 167ccc2..331d033 100644 --- a/Server/src/SOR.Bazaar/Handlers/BazaarGetStoreHandler.cs +++ b/Server/src/SOR.Bazaar/Handlers/BazaarGetStoreHandler.cs @@ -45,7 +45,7 @@ internal sealed class BazaarGetStoreHandler : BazaarHandlerBase, IMessageHandler .ToListAsync(ct); var decks = await _bazaarDb.PrebuiltDecks - .Where(d => d.IsActive + .Where(d => d.IsActive && d.IsAvailableInShop && (d.AvailableFrom == null || d.AvailableFrom <= now) && (d.AvailableUntil == null || d.AvailableUntil >= now)) .OrderBy(d => d.Name)