changeset 3423:0d927a189130

プログラムを改良しました
author houtin <c115080@g.koeki-u.ac.jp>
date Thu, 27 Jul 2017 08:02:31 +0900
parents 4a01c2b6cd01
children 306d0c1f6cc2
files event/oasis2017/quiz/hutsu.rb event/oasis2017/quiz/muzukasi.rb
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/event/oasis2017/quiz/hutsu.rb	Thu Jul 27 07:29:59 2017 +0900
+++ b/event/oasis2017/quiz/hutsu.rb	Thu Jul 27 08:02:31 2017 +0900
@@ -50,11 +50,12 @@
   now = Time.now.strftime("%F %T")
   db.execute("REPLACE INTO users VALUES(?, ?, ?)", id, form_name, now);
 else				# 若namedb
-  dbname = db.execute("SELECT name from users WHERE id=?", id)[0][0]
-  if dbname != nil
-    playname = dbname		# 若帥若鴻ゅ
+   dbn = db.execute("SELECT name from users WHERE id=?", id)[0]
+  if dbn != nil &&  dbn[0]
+    playname = dbn[0]           # 若帥若鴻ゅ
   end
 end
+
 if playname == ""
   print(<<-EOF)
 	<form action="#{File.basename($0)}" method="POST">
--- a/event/oasis2017/quiz/muzukasi.rb	Thu Jul 27 07:29:59 2017 +0900
+++ b/event/oasis2017/quiz/muzukasi.rb	Thu Jul 27 08:02:31 2017 +0900
@@ -50,11 +50,12 @@
   now = Time.now.strftime("%F %T")
   db.execute("REPLACE INTO users VALUES(?, ?, ?)", id, form_name, now);
 else				# 若namedb
-  dbname = db.execute("SELECT name from users WHERE id=?", id)[0][0]
-  if dbname != nil
-    playname = dbname		# 若帥若鴻ゅ
+   dbn = db.execute("SELECT name from users WHERE id=?", id)[0]
+  if dbn != nil &&  dbn[0]
+    playname = dbn[0]           # 若帥若鴻ゅ
   end
 end
+
 if playname == ""
   print(<<-EOF)
 	<form action="#{File.basename($0)}" method="POST">

yatex.org