You are on page 1of 15

Information system of online

quiz system

By

Micky Yun Chan


Database and information systems
CONTENTS

Assignment SPECIFICATION .............................................................................. 2


Conceptual model .................................................................................................. 3
Entity types ............................................................................................................ 3
DATA MODELS ................................................................................................... 4
Integrity Restrictions:............................................................................................. 5
State Analysis .......................................................................................................... 5
5. Functional Analysis ........................................................................................ 6
6. Design of User Interface .............................................................................. 13

1
ASSIGNMENT SPECIFICATION

WHY? We need an information system for the management of


an online quiz platform.
WHO? The system can be used by people register as user.
There are two types of users, quiz creator and quiz taker. Quiz
creator can upload, delete, modify content of his/her quiz.
While quiz taker can only take the quiz.
INPUTS: Users can create information about each quiz
question, also about quiz itself such as the categories it belong
to, list of participate tests.
Output: Information about status of each test for each user,
grade for each test.
FUNCTIONS:
System has to provide list of quiz to quiz taker to choose from,
it has to record how many correct answer they got in each quiz
if they done it before. It has to record list of quiz that they took.
It also has to had a user login system in place and there is an
option to rate/like the quiz. It also has to record the time they
start and finished the quiz.
As for quiz creator functionality include:
Login, provide the list of quiz they created, modification of
quiz and quiz question and also delete the quiz.
Finally there is user type admin which are responsible for
updating category and user management.

2
CONCEPTUAL MODEL

Entity types
Legend: Table, Primary Key, foreign key, attribute

User(id, login, name, surname,type)


Quiz(id, name, description, creation date, creator, id_category)
Quiz question(id, question, choice A, choice B, choice C,
choice D, id_quiz)
Quiz grade(Quiz_grade_id, user_id, quiz_id, grade)
Quiz time(Quiz_time_id, user_id, quiz_id, time started, time
finished)
Like(Like_id, id_user, id_quiz, type of like/unlike)
Category(id, name, description)
QuizRanking(id_Quiz, number of time taken, number of like)
UserRanking(id_UserRanking, id_Quiz, id_user, grade, times
started, times finished)

3
DATA MODELS

Description of tables is depicted in the following tables

Table User

Table Quiz

Table Quiz_question

Table Quiz_grade

Table Quiz_time

4
Table Like

Table Category

Integrity Restrictions:

1. Type: admin, taker, creator


2. Login – unique
3. Type of like – must be from 1 to 10

State Analysis

We define the status of quiz from Taker point of view:


• Not started (grade will be null)
• Started but not finish (time finished will be null)
• Finished the quiz (time finished will be recorded)
• Liked the quiz (a record will exist in like table)
from Creator point of view:
• Created a quiz (attribute in Quiz.creator)

5
5. Functional Analysis

5.1 List of Functions


1. User Management
Table: User, Responsibility: Admin
• 1.1 User Insert
• 1.2 User Update
• 1.3 User Delete
• 1.4 List of Users - with a definition of a filter to search users

• 1.5 User detail


Responsibility: Admin; Taker and Creator can only see their own record

2. Quiz management
Table: Quiz, Category, Quiz_question
Responsibility: Creator
• 2.1 New quiz
• 2.2 Update quiz
• 2.3 Delete quiz
• 2.4 Add new quiz questions
Table: Quiz question, Quiz
• 2.5 Update quiz question
• 2.6 Delete quiz question

6
3. List of Quiz
Table: all
• 3.1 Get Quiz from a selected category
• 3.2 Get Quiz from a selected creator by
login id
• 3.3 Get Quiz by above a certain number
of like
• 3.4 Get Quiz that a selected User
haven’t take
• 3.5 Get Quiz from a selected user by
order of grading
• 3.6 Get the Quiz with most question
4. List of takers
Table: all
• 4.1 Get list of User that finished a
selected quiz
• 4.2 Get list of User by order of grade of
all quiz that they have finish
• 4.3 Get list of User that are most active
from a selected category
• 4.4 Get the top user from a selected
quiz
• 4.5 print users that finish a selected test
with the time they take to finish
• 4.6 record grade, timestarted,
timefinsihed

7
5. Category management
Table: Category, Responsibility: Admin
• 5.1 New category
• 5.2 Category update
• 5.3 Category delete
• 5.4 list of categories

5.2 Detail Description of Functions

• 3.1 Get Quiz from a selected category


Parameter: $category.name
select * from quiz inner join CATEGORY on
quiz.CATEGORY_ID_CATEGORY =
CATEGORY.ID_CATEGORY where
CATEGORY.NAME = $category.name;
• 3.2 Get Quiz from a selected creator
Parameter: $login
select * from quiz inner join "User" on
quiz.CREATOR = (select user.name from user
where user.login = $login) ;

8
• 3.3 Get Quiz by above a certain number
of like
Parameter: $NumberofLike
Create or replace Procedure Get_Quiz_by_list(NumberofLike in int)
is
CURSOR C_Quiz is select id_quiz, name from Quiz;
Cursor C_like is select quiz_id_quiz, numberoflike from "Like";
V_Quiz C_Quiz%rowtype;
V_like C_like%rowtype ;
V_total int;

Begin
Open C_Quiz;
Loop
V_total := 0;
Fetch C_Quiz into V_Quiz;
Open C_like;
Loop
Fetch C_like into V_like;
If V_like.Quiz_id_quiz = V_Quiz.id_quiz
Then V_total := V_like.numberoflike + V_total;

End if;

9
End LOOP;
Close C_Like;

If V_total > numberoflike THEN


DBMS_OUTPUT.put_line(V_Quiz.name);
END IF;
END LOOP;
Close C_Quiz;

EXCEPTION
WHEN OTHERS THEN ROLLBACK ;
END;

• 4.3 Get list of User that are most active


from a selected category by number of
Quiz they completed
Parameter: $CategoryName

Create or replace Procedure Active_user_categories(p_categoryName in


VARCHAR2)
is
CURSOR C_Quiz is select * from Quiz inner join CATEGORY on
Category.id_category = Quiz.CATEGORY_ID_CATEGORY
inner join Quiz_grade on Quiz.ID_QUIZ =
QUIZ_GRADE.QUIZ_ID_QUIZ
where CATEGORY.NAME = p_categoryName;
CURSOR C_User is select id_user,name from "User";
V_Quiz C_Quiz%rowtype;

10
V_User C_User%rowtype;
V_total int;
Begin
Open C_User;
Loop
V_total := 0;
Fetch C_User into V_User;
Open C_Quiz;
Loop
Fetch C_Quiz into V_Quiz;
If V_User.id_user = V_Quiz.user_id_user
Then
IF V_Quiz.grade is not NUll
then
V_total := V_quiz.grade + V_total;
End if;
End if;
End LOOP;
Close C_Quiz;
DBMS_OUTPUT.put_line(V_User.name || V_Total );

END LOOP;
Close C_User;

EXCEPTION
WHEN OTHERS THEN ROLLBACK ;
END;

11
• 4.5 print users that finish a selected test
with the time they take to finish
Parameter: p_quizName

Create or replace Procedure User_time_quiz(p_quizName in


VARCHAR2 )
is
CURSOR C_Quiz is select * from Quiz inner join Quiz_Time on
Quiz.id_quiz = Quiz_time.Quiz_id_Quiz
where quiz.name = p_quizName;
CURSOR C_User is select id_user,name from "User" ;
V_Quiz C_Quiz%rowtype;
V_User C_User%rowtype;
V_time int;
Begin
Open C_User;
Loop

Fetch C_User into V_User;


Open C_Quiz;
Loop
Fetch C_Quiz into V_Quiz;
If V_User.id_user = V_Quiz.user_id_user
Then
IF V_Quiz.time_started is not NUll
then

12
V_time := V_quiz.time_started - V_quiz.time_finished;
End if;
End if;
End LOOP;
Close C_Quiz;
DBMS_OUTPUT.put_line(V_User.name || V_Time );

END LOOP;
Close C_User;

EXCEPTION
WHEN OTHERS THEN ROLLBACK ;
END;

6. Design of User Interface

6.1 Menu
1. Quiz taking (responsibility: taker)
(a) Take a Quiz – action 4.6

2. New quiz(responsibility: creator)


(a) Create new quiz
(b) create new quiz question
3. Profile(responsibly: Taker, creator)

13
4. Administration( responsibility: Admin)
(a) User Management – see 1 in function
(b) Category management

14

You might also like