Git Product home page Git Product logo

online_test's Introduction

Online Tests for Interviews

DATABASE NAME

Development - online_test_dev Test - online_test_test

Schema definitions

Create users table

CREATE TABLE USERS (
id SERIAL,
first_name varchar(100),
last_name varchar(100),
email varchar(100),
college varchar(200),
branch varchar(100),
city varchar(100),
password varchar(100),
password_confirmation varchar(100),
phone_number varchar(100),
batch varchar(100),
role varchar(50),
created_at timestamptz,
year_of_passing varchar(4),
PRIMARY KEY(id));

Create sessions table

CREATE TABLE sessions(
id int,
start_time timestamptz,
end_time timestamptz,
user_id int,
CONSTRAINT session_id_key FOREIGN KEY (user_id)
REFERENCES users (id),
auth_token varchar(320),
UNIQUE (auth_token));

Create Section table

CREATE TABLE SECTIONS (
id int,
name varchar(100),
PRIMARY KEY(id));

Create Questions table

CREATE TABLE QUESTIONS (
id int,
title text,
option_1 varchar(1000),
option_2 varchar(1000),
option_3 varchar(1000),
option_4 varchar(1000),
answer varchar(1000),
section_id int,
CONSTRAINT section_id_key FOREIGN KEY(section_id)
REFERENCES sections(id),
PRIMARY KEY(id));

Create Result table

CREATE TABLE RESULTS (
id SERIAL,
user_id int,
CONSTRAINT session_section_key FOREIGN KEY(user_id)
REFERENCES users(id),
first_name varchar(100),
last_name varchar(100),
email varchar(100),
phone_number varchar(100),
city varchar(100),
batch varchar(100),
section_1 int DEFAULT 0,
section_2 int DEFAULT 0,
section_3 int DEFAULT 0,
total_score int DEFAULT 0,
start_time timestamptz,
end_time timestamptz,
test_finished boolean DEFAULT 'no'
);

Inputs data and fields required for running API

Create User

URL - http://localhost:3000/sign_up

Method POST

Data has to be sent in raw format

{"firstname":"steve","lastname":"jobs","email":"[email protected]","password":"password","password_confirmation":"password","Branch":"Information Science","Year_of_passing":"2014","Phone_number":"9916854300","Auth_token":"039d51057a2c6125ba53fe6d90daee31837fbc76145dad6186f036cf1d2"}

The user registers for online exam . A session is created as soon as he signs up.

JSON Response

{
	"Success": "true",
	"Message": "User created Successfully!",
	"User": {
		"Id": 1,
		"Firstname": "steve",
		"Lastname": "jobs",
		"Email": "[email protected]",
		"Password": "password",
		"Password_confirmation": "password",
		"Branch": "Information Science",
		"Year_of_passing": "2014",
		"Phone_number": "9916854300",
		"Auth_token": "039d51057a2c6125ba53fe6d90daee31837fbc76145dad6186f036cf1d2"
	},
	"Session": {
		"SessionId": 1,
		"StartTime": "2016-03-04T00:59:49.784724111+05:30"
	}
}

Evaluate answers

URL - http://localhost:3010/section/evaluate

Method POST

Data has to be sent in raw format

{"SectionId":1, "UserId":12, "Questions":[{"QuestionId":1,"Answer":"a"},{"QuestionId":2,"Answer":"a"},{"QuestionId":3,"Answer":"a"},{"QuestionId":4,"Answer":"a"},{"QuestionId":5,"Answer":"a"},{"QuestionId":6,"Answer":"a"},{"QuestionId":7,"Answer":"a"},{"QuestionId":8,"Answer":"a"},{"QuestionId":9,"Answer":"a"},{"QuestionId":10,"Answer":"a"},{"QuestionId":11,"Answer":"a"},{"QuestionId":12,"Answer":"a"}]}

JSON Response

{
	"Section": 1,
	"TotalQuestions": 20,
	"Score": 0
}

online_test's People

Watchers

James Cloos avatar Suhas Ramesh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.