Explorar o código

ctrl+c ctrl+v

encrypt %!s(int64=8) %!d(string=hai) anos
pai
achega
6768435a7a
Modificáronse 1 ficheiros con 9 adicións e 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",