Skip to content

Commit

Permalink
Fixed bug when updating question's answers, made sql dump data make s…
Browse files Browse the repository at this point in the history
…ensegit status
  • Loading branch information
ElanMan committed Oct 31, 2014
1 parent e2ec683 commit a5d1fd3
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 31 deletions.
2 changes: 1 addition & 1 deletion SimpleQuiz/Utils/RadioQuestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function updateAnswers(Array $answers)
*/
public function deleteAnswers()
{
\ORM::for_table('answers')->where('quiz_id', $this->_id)->where('question_num',
\ORM::for_table('answers')->where('quiz_id', $this->_quizid)->where('question_num',
$this->_num)->delete_many();

return true;
Expand Down
90 changes: 61 additions & 29 deletions simple-quiz.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 31, 2014 at 10:39 AM
-- Generation Time: Oct 31, 2014 at 07:45 PM
-- Server version: 5.5.40
-- PHP Version: 5.4.4-14+deb7u14

Expand Down Expand Up @@ -36,7 +36,7 @@ CREATE TABLE IF NOT EXISTS `answers` (
KEY `question_id` (`correct`),
KEY `quiz_id` (`quiz_id`),
KEY `quiz_question_num` (`question_num`,`quiz_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=562 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=616 ;

--
-- Dumping data for table `answers`
Expand All @@ -63,27 +63,48 @@ INSERT INTO `answers` (`id`, `question_num`, `quiz_id`, `text`, `correct`) VALUE
(461, 7, 6, 'Jeff Goldblum', 0),
(462, 7, 6, 'Jeff Bridges', 0),
(463, 7, 6, 'Jeff Branson', 0),
(470, 2, 8, 'Botham', 1),
(471, 2, 8, 'Beckham', 0),
(477, 1, 8, 'Muhammad Ali', 1),
(478, 1, 8, 'Samuel L Jackson', 0),
(536, 1, 6, 'Tom Hanks', 1),
(537, 1, 6, 'Bob Hoskins', 0),
(538, 1, 6, 'Robert De Niro', 0),
(539, 1, 6, 'Marlon Brando', 0),
(540, 4, 6, 'Stan and Oliver', 0),
(541, 4, 6, 'Stan and Groucho', 1),
(542, 4, 6, 'Bob and Billy', 0),
(545, 1, 9, 'dsadsadsadsad', 1),
(546, 1, 9, 'dsa', 0),
(547, 2, 9, 'yesy', 1),
(548, 2, 9, 'no', 0),
(549, 1, 10, 'Freddie', 1),
(550, 1, 10, 'Bob', 0),
(551, 1, 10, 'Jimmy', 0),
(552, 1, 10, 'Richard', 0),
(560, 2, 10, 'a1', 1),
(561, 2, 10, 'a2', 0);
(562, 2, 10, 'Eric Clapton', 1),
(563, 2, 10, 'Eric Banner', 0),
(564, 2, 10, 'Eric Cantona', 0),
(565, 2, 10, 'Eric Clapton', 1),
(566, 2, 10, 'Eric Banner', 0),
(567, 2, 10, 'Eric Cantona', 0),
(568, 3, 10, 'George Michael', 1),
(569, 3, 10, 'George Bernard Shaw', 0),
(570, 4, 10, 'Frank Beard', 1),
(571, 4, 10, 'Frank Nobeard', 0),
(587, 4, 6, 'Stan and Oliver', 1),
(588, 4, 6, 'Stan and Groucho', 0),
(589, 4, 6, 'Bob and Billy', 0),
(590, 1, 8, 'Muhammad Ali', 1),
(591, 1, 8, 'Samuel L Jackson', 0),
(592, 1, 8, 'Nigel Manson', 0),
(593, 2, 8, 'Botham', 1),
(594, 2, 8, 'Beckham', 0),
(595, 2, 8, 'Beardsley', 0),
(596, 3, 8, 'Best', 1),
(597, 3, 8, 'Of The Jungle', 0),
(598, 3, 8, '''Dubya'' Bush', 0),
(601, 4, 8, 'Juggling', 1),
(602, 4, 8, 'Football', 0),
(603, 4, 8, 'Downhill Skiing', 0),
(607, 1, 11, 'Alexander Graham Bell', 1),
(608, 1, 11, 'Barry Manilow', 0),
(609, 1, 11, 'Albert Einstein', 0),
(610, 2, 11, 'Albert Einstein', 1),
(611, 2, 11, 'David Beckham', 0),
(612, 2, 11, 'Samuel Johnson', 0),
(613, 3, 11, 'Edward Jenner', 1),
(614, 3, 11, 'Edward Scissorhands', 0),
(615, 3, 11, 'Edward G Robinson', 0);

-- --------------------------------------------------------

Expand Down Expand Up @@ -126,7 +147,7 @@ CREATE TABLE IF NOT EXISTS `questions` (
KEY `num` (`num`),
KEY `num_2` (`num`,`quiz_id`),
KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=40 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=48 ;

--
-- Dumping data for table `questions`
Expand All @@ -142,10 +163,15 @@ INSERT INTO `questions` (`id`, `num`, `quiz_id`, `text`) VALUES
(21, 7, 6, 'Who starred in ''Chasing Sleep'' from 2000'),
(23, 1, 8, 'Famous Boxer'),
(24, 2, 8, 'Famous cricketer'),
(30, 1, 9, 'dsadsaddsa'),
(31, 2, 9, 'the second question'),
(32, 1, 10, 'Singer: ... Mercury'),
(39, 2, 10, 'q5');
(32, 1, 10, 'Lead singer of the band Queen'),
(40, 2, 10, 'A member of Cream'),
(41, 3, 10, 'Singer in Wham!'),
(42, 4, 10, 'Drummer In ZZ Top'),
(43, 3, 8, 'Footballer, George ...'),
(44, 4, 8, 'Not An Olympic Event'),
(45, 1, 11, 'Invented The Telephone'),
(46, 2, 11, 'Known For e=mc2'),
(47, 3, 11, 'Pioneer Of The Smallpox Vaccination');

-- --------------------------------------------------------

Expand All @@ -166,7 +192,7 @@ CREATE TABLE IF NOT EXISTS `quizzes` (
KEY `id` (`id`),
KEY `created` (`created`),
KEY `updated` (`updated`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;

--
-- Dumping data for table `quizzes`
Expand All @@ -175,8 +201,8 @@ CREATE TABLE IF NOT EXISTS `quizzes` (
INSERT INTO `quizzes` (`id`, `name`, `description`, `category`, `active`, `created`, `updated`) VALUES
(6, 'Movies R Us', 'Know your movie trivia? Prove it!', 2, 1, '2013-11-21 21:55:12', '2014-10-19 22:33:36'),
(8, 'Sporting Greats', 'Do you know these sporting legends?', 1, 1, '2014-01-27 19:40:52', '2014-05-23 23:24:02'),
(9, 'A Thirdone', 'the third quiz', 3, 1, '2014-10-19 21:33:59', '2014-10-20 18:17:51'),
(10, 'Musicality', 'A Major Musical Quiz', 6, 1, '2014-10-20 17:19:01', '2014-10-31 08:12:35');
(10, 'Band Members', 'Name the member of these famous bands', 6, 1, '2014-10-20 17:19:01', '2014-10-31 19:24:24'),
(11, 'Famous Scientists', 'Name These Pioneers Of Science', 5, 1, '2014-10-31 19:35:56', '2014-10-31 19:35:56');

-- --------------------------------------------------------

Expand All @@ -195,7 +221,7 @@ CREATE TABLE IF NOT EXISTS `quiz_users` (
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `quiz_id` (`quiz_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=30 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;

--
-- Dumping data for table `quiz_users`
Expand All @@ -204,11 +230,11 @@ CREATE TABLE IF NOT EXISTS `quiz_users` (
INSERT INTO `quiz_users` (`id`, `quiz_id`, `user_id`, `score`, `start_time`, `date_submitted`, `time_taken`) VALUES
(23, 6, 193, 3, '2014-10-30 20:35:46', '2014-10-30 20:36:14', '00:28'),
(24, 8, 194, 2, '2014-10-30 21:29:44', '2014-10-30 21:29:52', '00:08'),
(25, 9, 194, 1, '2014-10-30 22:22:25', '2014-10-30 22:22:35', '00:10'),
(26, 6, 192, 3, '2014-10-31 07:54:37', '2014-10-31 07:57:16', '02:39'),
(27, 8, 192, 2, '2014-10-31 07:58:50', '2014-10-31 07:59:02', '00:12'),
(28, 10, 192, 1, '2014-10-31 08:40:57', '2014-10-31 08:41:04', '00:07'),
(29, 10, 194, 2, '2014-10-31 08:43:18', '2014-10-31 08:43:24', '00:06');
(29, 10, 194, 2, '2014-10-31 08:43:18', '2014-10-31 08:43:24', '00:06'),
(30, 11, 196, 3, '2014-10-31 19:42:15', '2014-10-31 19:42:32', '00:17');

-- --------------------------------------------------------

Expand All @@ -228,7 +254,12 @@ CREATE TABLE IF NOT EXISTS `sessions` (
--

INSERT INTO `sessions` (`id`, `access`, `data`) VALUES
('jnq939iqqplidsm954s5tjrl32', 1414751945, 'quizid|s:1:"8";score|i:0;correct|a:0:{}wrong|a:0:{}finished|s:2:"no";num|i:0;last|N;timetaken|N;starttime|N;slim.flash|a:0:{}');
('0e8k4b8n024kjqvm9dbu7ta9n4', 1414784572, 'slim.flash|a:0:{}'),
('1c4m0jstuh95eua9uegbeepul1', 1414774607, 'slim.flash|a:0:{}'),
('f7n557mcs3u2576h93svrsmte0', 1414774675, 'slim.flash|a:0:{}'),
('jnq939iqqplidsm954s5tjrl32', 1414774562, 'quizid|s:2:"10";score|i:0;correct|a:0:{}wrong|a:0:{}finished|s:2:"no";num|i:0;last|N;timetaken|N;starttime|N;slim.flash|a:0:{}urlRedirect|s:13:"/quiz/process";'),
('omup8j6s8jet7fb7l48ebhk9v5', 1414784443, 'slim.flash|a:0:{}quizid|s:2:"11";score|i:0;correct|a:0:{}wrong|a:0:{}finished|s:2:"no";num|i:0;last|N;timetaken|N;starttime|N;urlRedirect|s:13:"/quiz/process";'),
('tgohnb0bhrok34tfrnrslsnlf2', 1414784488, 'slim.flash|a:0:{}');

-- --------------------------------------------------------

Expand All @@ -245,7 +276,7 @@ CREATE TABLE IF NOT EXISTS `users` (
PRIMARY KEY (`id`),
KEY `name` (`name`),
KEY `pass` (`pass`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=196 ;
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=197 ;

--
-- Dumping data for table `users`
Expand All @@ -256,7 +287,8 @@ INSERT INTO `users` (`id`, `name`, `pass`, `email`, `level`) VALUES
(192, 'user1', '$2y$10$D2tpVb9i6GsPawn1H18tCu2s.2T9uHHWMQY7Osyeh12AzJsJ9Y5VO', '[email protected]', 0),
(193, 'user2', '$2y$10$DOueZ880b4buKA2sm0a67OzZNSfv3ev7DT31tI53Moq1pGA9h/Dx6', '[email protected]', 0),
(194, 'user3', '$2y$10$cUcIj1qyd1rWYE3vQTXW8emBx27Je9ZWcgNMDUnKN3a5n9kCED/S2', '[email protected]', 0),
(195, 'user3', '$2y$10$n1Y3HJSwWxq0toQa8pQzb.kra1mfMySsaCsC/bH0/oE3oMNLM7GmO', '[email protected]', 0);
(195, 'user4', '$2y$10$n1Y3HJSwWxq0toQa8pQzb.kra1mfMySsaCsC/bH0/oE3oMNLM7GmO', '[email protected]', 0),
(196, 'user6', '$2y$10$B4ufMwQ9BzhGLVfY0CTBseqVIhSbRk1XQB8zu5LmOor9uAeLXeQIa', '[email protected]', 0);

--
-- Constraints for dumped tables
Expand Down
1 change: 0 additions & 1 deletion templates/admin/footer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script src="<?php echo $root; ?>/res/bootstrap/assets/js/jquery.js"></script>
<script src="<?php echo $root; ?>/res/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="<?php echo $root; ?>/res/js/admin.js"></script>
<script type="text/javascript" src="<?php echo $root; ?>/res/js/general.js"></script>
</body>
</html>

0 comments on commit a5d1fd3

Please sign in to comment.