@@ -155,29 +155,36 @@ defmodule ExplorerWeb.Home.Index do
155155 stats: [ ] ,
156156 latest_batches: [ ] ,
157157 cost_per_proof_chart: % { points: [ ] , extra_data: % { } } ,
158- batch_size_chart_data: % { points: [ ] , extra_data: % { } }
158+ batch_size_chart_data: % { points: [ ] , extra_data: % { } } ,
159+ next_scheduled_batch_remaining_time_percentage: 0 ,
160+ next_scheduled_batch_remaining_time: 0
159161 )
160162 end
161163
162164 @ impl true
163165 def handle_info ( _ , socket ) do
164166 latest_batches = Batches . get_latest_batches ( % { amount: 10 , order_by: :desc } )
165167 charts_query_limit = 20
168+ remaining_time = Helpers . get_next_scheduled_batch_remaining_time ( )
166169
167170 { :noreply ,
168171 assign (
169172 socket ,
170173 stats: get_stats ( ) ,
171174 latest_batches: latest_batches ,
172175 cost_per_proof_chart: get_cost_per_proof_chart_data ( charts_query_limit ) ,
173- batch_size_chart_data: get_batch_size_chart_data ( charts_query_limit )
176+ batch_size_chart_data: get_batch_size_chart_data ( charts_query_limit ) ,
177+ next_scheduled_batch_remaining_time_percentage:
178+ Helpers . get_next_scheduled_batch_remaining_time_percentage ( remaining_time ) ,
179+ next_scheduled_batch_remaining_time: remaining_time
174180 ) }
175181 end
176182
177183 @ impl true
178184 def mount ( _ , _ , socket ) do
179185 latest_batches = Batches . get_latest_batches ( % { amount: 10 , order_by: :desc } )
180186 charts_query_limit = 20
187+ remaining_time = Helpers . get_next_scheduled_batch_remaining_time ( )
181188
182189 if connected? ( socket ) , do: Phoenix.PubSub . subscribe ( Explorer.PubSub , "update_views" )
183190
@@ -187,6 +194,9 @@ defmodule ExplorerWeb.Home.Index do
187194 latest_batches: latest_batches ,
188195 cost_per_proof_chart: get_cost_per_proof_chart_data ( charts_query_limit ) ,
189196 batch_size_chart_data: get_batch_size_chart_data ( charts_query_limit ) ,
197+ next_scheduled_batch_remaining_time_percentage:
198+ Helpers . get_next_scheduled_batch_remaining_time_percentage ( remaining_time ) ,
199+ next_scheduled_batch_remaining_time: remaining_time ,
190200 page_title: "Welcome"
191201 ) }
192202 rescue
0 commit comments