From 5353d2cd91581f6a7b661f523207f9a6df87a56b Mon Sep 17 00:00:00 2001 From: "Kyle D. McCormick" Date: Fri, 26 Jul 2024 17:40:49 -0400 Subject: [PATCH] temp: suffix with upstream info, for testing --- xmodule/capa_block.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/xmodule/capa_block.py b/xmodule/capa_block.py index 54ca0cbc312f..9b821c1822c4 100644 --- a/xmodule/capa_block.py +++ b/xmodule/capa_block.py @@ -486,10 +486,22 @@ def display_name_with_default(self): Default to the display_name if it isn't None or not an empty string, else fall back to problem category. """ + # @@TODO: temporary suffix code + from openedx.core.djangoapps.content_libraries.sync import BadUpstream + try: + upstream_meta = self.get_upstream_meta() + except BadUpstream: + suffix = "" + else: + latest = upstream_meta.version_num + suffix = f" [v{self.upstream_version}]" + if self.upstream_version < latest: + suffix += f" [UPDATE AVAILBLE: v{latest}]" + if self.display_name is None or not self.display_name.strip(): - return self.location.block_type + return self.location.block_type + suffix - return self.display_name + return self.display_name + suffix def grading_method_display_name(self) -> str | None: """