From 5f22278e9014777196eae6c775a97937b3a98c6d Mon Sep 17 00:00:00 2001 From: Forrest Collman Date: Tue, 30 Jul 2024 08:16:55 -0700 Subject: [PATCH] fix bug with no views in version --- materializationengine/views.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/materializationengine/views.py b/materializationengine/views.py index c12cae0e..a28963c0 100644 --- a/materializationengine/views.py +++ b/materializationengine/views.py @@ -354,15 +354,18 @@ def version_view(datastack_name: str, id: int): col_value=None, datastack_name=datastack_name, ) - views_df["ng_link"] = views_df.apply( - lambda x: f"seg prop link", - axis=1, - ) - classes = ["table table-borderless"] - with pd.option_context("display.max_colwidth", -1): - output_view_html = views_df.to_html( - escape=False, classes=classes, index=False, justify="left", border=0 + if len(views_df) > 0: + views_df["ng_link"] = views_df.apply( + lambda x: f"seg prop link", + axis=1, ) + classes = ["table table-borderless"] + with pd.option_context("display.max_colwidth", -1): + output_view_html = views_df.to_html( + escape=False, classes=classes, index=False, justify="left", border=0 + ) + else: + output_view_html = "

No views in datastack

" return render_template( "version.html",