diff --git a/dashboard/Sugartrail.ipynb b/dashboard/Sugartrail.ipynb index 5c0ae91..bd11da8 100644 --- a/dashboard/Sugartrail.ipynb +++ b/dashboard/Sugartrail.ipynb @@ -151,25 +151,25 @@ "navigation_button = widgets.Button(description='Update', disabled=True)\n", "navigation_button.on_click(lambda bt: config_network()) \n", "\n", - "def init_network():\n", - " init_button.disabled=True\n", - " response = sugartrail.api.get_company(str(company_text.value))\n", - " company_text.disabled=True\n", + "def init_network(bt):\n", + " init_button.disabled = True\n", + " company_id = company_text.value # Capture the latest value of company_text\n", + " response = sugartrail.api.get_company(str(company_id))\n", + " company_text.disabled = True\n", " if response:\n", - " network.company_id = str(company_text.value)\n", + " network.company_id = company_id\n", " init_status.value = u'\\u2705: Initialisation successful for ' + str(response['company_name']) \n", - " init_button.button_style='success'\n", + " init_button.button_style = 'success'\n", " navigation_button.disabled = False\n", " depth_selector.disabled = False\n", " generate_network_button.disabled = False\n", - " logger.debug(f\"Company number entered: {str(company_text.value)}\")\n", - " \n", + " logger.debug(f\"Company number entered: {company_id}\") # Log the captured value\n", " else:\n", - " init_button.disabled=False\n", - " company_text.disabled=False\n", - " init_status.value = u'\\u274c: Initialisation Failed. No records for company: ' + str(company_text.value)\n", + " init_button.disabled = False\n", + " company_text.disabled = False\n", + " init_status.value = u'\\u274c: Initialisation Failed. No records for company: ' + company_id\n", "\n", - "display(company_text, init_button, init_status)" + "display(company_text, init_button, init_status)\n" ] }, {