Browse Source

bereit machen für 2017

hmt 7 years ago
parent
commit
d34643fdee
6 changed files with 51 additions and 36 deletions
  1. 35 25
      Gemfile.lock
  2. 10 5
      sv.rb
  3. 1 1
      views/ergebnis.slim
  4. 2 2
      views/hashid.slim
  5. 1 1
      views/home.slim
  6. 2 2
      views/layout.slim

+ 35 - 25
Gemfile.lock

@@ -2,41 +2,51 @@ GEM
   remote: https://rubygems.org/
   specs:
     coderay (1.1.1)
-    envyable (1.1.0)
+    envyable (1.2.0)
       thor (>= 0.18.1, < 2.0)
-    hashids (1.0.2)
+    ffi (1.9.18)
+    hashids (1.0.4)
     method_source (0.8.2)
-    minitest (5.9.1)
+    minitest (5.10.3)
     minitest-rg (5.2.0)
       minitest (~> 5.0)
-    newrelic_rpm (3.16.3.323)
-    pg (0.19.0)
+    mustermann (1.0.1)
+    newrelic_rpm (4.4.0.336)
+    pg (0.21.0)
     pry (0.10.4)
       coderay (~> 1.1.0)
       method_source (~> 0.8.1)
       slop (~> 3.4)
-    puma (3.6.0)
-    rack (1.6.4)
-    rack-protection (1.5.3)
+    puma (3.10.0)
+    rack (2.0.3)
+    rack-protection (2.0.0)
       rack
-    rack-test (0.6.3)
-      rack (>= 1.0)
-    rake (11.3.0)
-    redcarpet (3.3.4)
-    sass (3.4.22)
-    sequel (4.39.0)
-    sinatra (1.4.7)
-      rack (~> 1.5)
-      rack-protection (~> 1.4)
-      tilt (>= 1.3, < 3)
-    slim (3.0.7)
-      temple (~> 0.7.6)
+    rack-test (0.7.0)
+      rack (>= 1.0, < 3)
+    rake (12.0.0)
+    rb-fsevent (0.10.2)
+    rb-inotify (0.9.10)
+      ffi (>= 0.5.0, < 2)
+    redcarpet (3.4.0)
+    sass (3.5.1)
+      sass-listen (~> 4.0.0)
+    sass-listen (4.0.0)
+      rb-fsevent (~> 0.9, >= 0.9.4)
+      rb-inotify (~> 0.9, >= 0.9.7)
+    sequel (5.0.0)
+    sinatra (2.0.0)
+      mustermann (~> 1.0)
+      rack (~> 2.0)
+      rack-protection (= 2.0.0)
+      tilt (~> 2.0)
+    slim (3.0.8)
+      temple (>= 0.7.6, < 0.9)
       tilt (>= 1.3.3, < 2.1)
     slop (3.6.0)
-    sqlite3 (1.3.11)
-    temple (0.7.7)
-    thor (0.19.1)
-    tilt (2.0.5)
+    sqlite3 (1.3.13)
+    temple (0.8.0)
+    thor (0.20.0)
+    tilt (2.0.8)
 
 PLATFORMS
   ruby
@@ -60,4 +70,4 @@ DEPENDENCIES
   sqlite3
 
 BUNDLED WITH
-   1.12.3
+   1.14.6

+ 10 - 5
sv.rb

@@ -38,6 +38,7 @@ end
 
 class SV < Sinatra::Application
   configure do
+    STOP_ZEIT = 'Oct 3, 2017, 18:00'
     enable :sessions
     set :session_secret, (ENV['SV_SESSION_SECRET'] || 'your_secret')
     Slim::Engine.set_options pretty: true
@@ -50,6 +51,10 @@ class SV < Sinatra::Application
   end
 
   helpers do
+    def ende
+      Time.now > time_for(STOP_ZEIT)
+    end
+
     def protected!
       return if authorized?
       headers['WWW-Authenticate'] = 'Basic realm="Bitte anmelden"'
@@ -77,7 +82,7 @@ class SV < Sinatra::Application
   end
 
   get '/' do
-    if Time.now > time_for('Oct 3, 2016, 18:00')
+    if ende
       redirect to("/ergebnis")
     end
     infos = Info.all
@@ -89,7 +94,7 @@ class SV < Sinatra::Application
   end
 
   post "/wahl" do
-    if Time.now > time_for('Sep 30, 2016, 18:00')
+    if ende
       session[:flash] = [0, "Sie können sich nicht mehr aufstellen lassen, die Wahl hat bereits begonnen"]
       redirect back
     end
@@ -125,7 +130,7 @@ class SV < Sinatra::Application
   end
 
   get '/ergebnis' do
-    protected! if Time.now < time_for('Oct 3, 2016, 18:00')
+    protected! if !ende
     sprecher, schuko, lehrer, waehler = [], [], [], 0
     DB.transaction do
       sprecher = Schueler.where(:sprecher => true).all
@@ -159,10 +164,10 @@ class SV < Sinatra::Application
   end
 
   post "/:hashid" do
-    if Time.now > time_for('Oct 3, 2016, 18:00')
+    if ende
       session[:flash] = [0, "Der Wahlzeitraum ist seit 3. Oktober 18:00 Uhr abgelaufen."]
       redirect back
-    elsif Time.now < time_for('Sep 30, 2016, 18:00')
+    else
       session[:flash] = [0, "Der Wahlzeitraum beginnt erst am 30. September um 18:00 Uhr."]
       redirect back
     end

+ 1 - 1
views/ergebnis.slim

@@ -1,4 +1,4 @@
-h1 Ergebnis der SV-Wahlen 2016
+h1 Ergebnis der SV-Wahlen #{Time.now.year}
 
 h2 Wahlbeteiligung
 |Von

+ 2 - 2
views/hashid.slim

@@ -17,7 +17,7 @@ h1 SV-Wahlen 2016
       =schueler.vorname
       |,
     h3 Die Wahl findet von Freitag 30. September 18 Uhr bis Montag 3. Oktober 18 Uhr statt.
-    -if Time.now < time_for('Sep 30, 2016, 18:00')
+    -if !ende
       |Bis dahin sollten alle Schüler und Studierenden des BK-Bethel Gelegenheit
        haben, sich für die Wahl aufstellen zu lassen.
       p
@@ -36,7 +36,7 @@ h1 SV-Wahlen 2016
     a<> href=url("/") Startseite
     |für eventuelle weitere Nachrichten.
 
--if Time.now < time_for('Sep 30, 2016, 18:00')
+-if !ende
   .panel.panel-info
     .panel-body
       h3 Für welche Ämter stellen Sie sich zur Verfügung?

+ 1 - 1
views/home.slim

@@ -1,4 +1,4 @@
-h1 SV-Wahlen 2016
+h1 SV-Wahlen #{Time.now.year}
 form method="post" action=url("/hashid")
   .row
     .col-xs-6.col-sm-4.col-lg-4

+ 2 - 2
views/layout.slim

@@ -1,10 +1,10 @@
 doctype 5
 html lang="en"
   head
-    title SV-Wahlen 2016
+    title SV-Wahlen #{Time.now.year}
     meta charset="utf-8"
     meta name="viewport" content="width=device-width, initial-scale=1.0"
-    meta name="application-name" content="SV-Wahlen 2016"
+    meta name="application-name" content="SV-Wahlen #{Time.now.year}"
     meta name="msapplication-TileColor" content="#FFFFFF"
     meta name="msapplication-TileImage" content=url("/assets/icons/mstile-144x144.png")
     link rel="apple-touch-icon-precomposed" sizes="57x57" href=url("/assets/icons/apple-touch-icon-57x57.png")