Explorar el Código

ctrl+c ctrl+v

encrypt hace 8 años
padre
commit
6768435a7a
Se han modificado 1 ficheros con 9 adiciones y 0 borrados
  1. 9 0
      webapp.rb

+ 9 - 0
webapp.rb

@@ -49,6 +49,15 @@ get '/hacklabbo/state.json' do
 end
 
 get '/hacklabbo/space.json' do
+  entry = Entry.all(limit: 1, order: [ :id.desc ])
+  state = {
+    open: false,
+    date: nil
+  }
+  unless entry.empty?
+    state[:open] = entry[0][:open]
+    state[:date] = entry[0][:date]
+  end
   content_type :json
   {
     api: "0.13",