school registration application

28
School Registration Application Chase Diem Tim Frasca CSC545 – Databases Spring 2014

Upload: isanne

Post on 09-Feb-2016

75 views

Category:

Documents


0 download

DESCRIPTION

School Registration Application. Chase Diem Tim Frasca. CSC545 – Databases Spring 2014. Outline. Introduction Class Model Database Diagram Use Cases – Student Use Case Diagram Examples Of Use Case Use Cases – Teacher Use Case Diagram Examples of Use Case Use Cases – Admin - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: School Registration Application

School Registration Application

Chase DiemTim Frasca

CSC545 – Databases

Spring 2014

Page 2: School Registration Application

Outline1. Introduction2. Class Model3. Database Diagram4. Use Cases – Student

1. Use Case Diagram2. Examples Of Use Case

5. Use Cases – Teacher1. Use Case Diagram2. Examples of Use Case

6. Use Cases – Admin1. Use Case Diagram2. Examples of Use Case

7. Conclusion1. What Was Easy2. What Was Hard

Page 3: School Registration Application

3

Class ModelUser

uId : intemail : Stringpassword : String admin : String

createUser() – Admin creates usersuserExists() – Verify user existsdeleteStudent() – Admin deletes studentsdeleteNonStudent() – Admin deletes other userslistStudent() – Teacher lists students for registrationlogin() – User logs indeleteUserList() – Admin lists users to delete

Course

cId : intname : String number : String section : intyear : Yearsemester : String building : String room : StringmaxStudents : intteacherId : int

createCourse() – Teacher creates.deleteCourse() – Teacher deletes.udpateCourse() – Teacher updates.listCoursesTeaching() – Teacher lists courses they teach.listCoursesStudentRegistered() – Student/teacher lists

who is registered to a coursegetCourse() – Get course information.listCoursesAll() – Lists summary of all coursesregisterStudent() – Teacher registers student for course.unregisterStudent() – Teacher unregistered student

from courselistStudentsInCourse() – Teacher gets listing of

students in course they are teachinglistStudentCourse() – Lists students in course for

un-registration purposeslistStudentsNotInCourse() – Teacher gets list of

students that can be registered for course

Assignment

aId : int csId : int name : String points : floatmaxPoints : float letterGrade : String dueDate : Date

createAssigment() – Teacher creates assignmentdeleteAssignment() – Teacher deletes assignmentlistAssignments() – Lists assignments for studentupdateAssinment() – Teacher edits assignment

1..* 0..*

0..*

Page 4: School Registration Application

cId int(11) PRI

name varchar(80)

number varchar(80)

section int(11)year year(4)

semester varchar(80)

building varchar(80)

room varchar(80)

maxStudents int(11)

teacherId int(11) FK

uId int(11) PRIemail varchar(80

) UNI

password varchar(80)

admin int(11)

ucId int(11) PRIuId int(11) FKcId int(11) FK

aId int(11) PRIcsId int(11) FK

name varchar(80)

points floatmaxPoints floatletterGrade varchar(1)dueDate date

USER USER_COURSE

COURSE

ASSIGNMENT

Database Diagram

Page 5: School Registration Application

Use Cases - Student

Student

login()

listAssignments()

Click course details getCourse()

Enter email, password

Successful login

listCoursesStudentRegistered() Click course

grades

Unsuccessful login

Error to re-login()

Page 6: School Registration Application

Use Cases – Student – Login

SELECT uId, email, password, admin FROM userWHERE email = 'email’ AND password = ‘password‘

SQL

Page 7: School Registration Application

Use Cases – Student – Login cont.

Student has logged in successfully.

SELECT uc.uId, c.cId, c.name, c.number, c.section,FORMAT((SUM(points)/SUM(maxPoints) * 100), 2) as averageFROM user_course uc JOIN course cON uc.cId = c.cId JOIN user s ON s.uId = uc.uIdLEFT JOIN assignment asg ON asg.csId = uc.ucIdWHERE s.uId = ‘studentId’GROUP BY uc.uId, c.cId, c.name, c.number, c.section

SQL

Page 8: School Registration Application

Use Cases – Student – View Courses

SELECT * FROM COURSE WHERE cId = 3

SQL

Page 9: School Registration Application

Use Cases – Student – View Grades

SELECT * FROM test.user_course uc JOIN test.assignment assg ON assg.csId = uc.ucId WHERE uc.cId = 3 AND uc.uId = 6

SQL

Page 10: School Registration Application

Use Cases – Student – Logout

No SQL involved.Session was emptied and redirect back to login page.

Page 11: School Registration Application

Use Cases - Teacher

Teacher

login()

listStudentsRegistered()

Click course details

getCourse()Enter email, password

Successful login

listCoursesTeaching()

Click students buttonUnsuccessful login

Error to re-login()

Click delete course button

Click addcourse button

Click editcourse button

updateCourse()

createCourse()

deleteCourse()

unregisterStudent()

Click unregister student button

Click register student button

registerStudent()

Click student grades button

listAssignments()

createAssignment()

deleteAssignment()

editAssignment()

Page 12: School Registration Application

Use Cases – Teacher– Login

SELECT uId, email, password, admin FROM userWHERE email = 'email’ AND password = ‘password‘

SQL

Page 13: School Registration Application

Use Cases – Teacher – Login cont.

Teacher has logged in successfully.

SELECT * FROM COURSEWHERE teacherId = ‘teacherId’

SQL

Page 14: School Registration Application

Use Cases – Teacher – Add Courses

INSERT INTO COURSE (name, number, section, year, semester, building, room, maxStudents, teacherId) VALUES ('New Test Course', 'CSC123', 456, 15, 'FALL', '148 University Ave', '222', 20, 4)

SQL

Teacher clicks Add New Course button.

Page 15: School Registration Application

Use Cases – Teacher – Edit Courses

UPDATE COURSE SET name = 'Databases Course xyz', number = 'CSC456', section = 11, year = 14, semester = 'SPRINtreG', building = '25 University Ave', room = '999', maxStudents = 999, teacherId = 2 WHERE  cId =  1

SQL

Page 16: School Registration Application

Use Cases – Teacher – Delete Courses

// Delete from assignment tableDELETE FROM assignment WHERE csId in (SELECT ucId FROM user_course WHERE cId = 2)// Delete from user_course tableDELETE FROM user_course WHERE cId = 2// delete from course tableDELETE FROM course WHERE cId = 2

SQL

Teacher clicks Delete Course button.

Page 17: School Registration Application

Use Cases – Teacher– View Students

Students in the classthe teacher is teaching.

SELECT u_c.uId, cId, email, admin, points, FORMAT((SUM(points)/SUM(maxPoints) * 100), 2) as average FROM USER_COURSE u_c LEFT JOIN USER u ON u_c.uId = u.uId LEFT JOIN ASSIGNMENT asg ON asg.csId = u_c.ucId WHERE cId = 3 GROUP BY u_c.uId, cId, email, admin

SQL

Page 18: School Registration Application

Use Cases – Teacher – View Students -

Grades

Teacher can view, edit and delete the grades of studentsin his/her class

SELECT * FROM test.user_course uc JOIN test.assignment assg ON assg.csId = uc.ucId WHERE uc.cId = 3 AND uc.uId = 6

SQL

Page 19: School Registration Application

Use Cases – Teacher – View Students – Add

Assignment

Teacher can add and delete a new assignment for any student in the class.

INSERT INTO ASSIGNMENT(csId, name, points, maxPoints, letterGrade, dueDate) VALUES (4, 'New Test', 99.9, 100.0, 'A', '2014-01-01')

SQL

Page 20: School Registration Application

Use Cases – Teacher – View Students – Edit

Assignment

Teacher can view, edit and delete the grades of students in his/her class

UPDATE ASSIGNMENT SET name = 'Exam 1', points = 33.4, maxPoints = 100.0, letterGrade = 'F', dueDate = '2014-07-21' WHERE aId = 10

SQL

Page 21: School Registration Application

Use Cases – Teacher – View Students – Delete

Assignment

Teacher can add and delete a new assignment for any student in the class.

DELETE FROM ASSIGNMENT WHERE aId = 12

SQL

Page 22: School Registration Application

Use Cases – Teacher – Un/Register Student

Teacher can register…

INSERT INTO user_course (uId, cId) VALUES (7, 3)

SQL

DELETE FROM user_course WHERE uId=' 7' AND cId='3';

SQL

…and unregister students.

Page 23: School Registration Application

Use Cases - Admin

Admin

login()

deleteNonStudent()

Enter email, password

Successful logincreateUser()

Unsuccessful login

Error to re-login()

deleteStudent()

Page 24: School Registration Application

Admin Cases – Home page

Admin can add or delete any student, teacher, or another admin.

Page 25: School Registration Application

Admin Cases – Add a User

Admin can add or delete any student, teacher, or another admin.

SQLINSERT INTO USER (email, password, admin) VALUES ('[email protected]', '123456', '0');

Page 26: School Registration Application

Admin Cases – Delete a User

SQL

DELETE FROM assignmentWHERE csId in

(SELECT ucId FROM user_courseWHERE uId = (SELECT uId FROM user where uId = '2'))

// Delete from user_course tableDELETE FROM user_course WHERE uId = '2'// delete from user tableDELETE FROM user WHERE uId = '2'

Page 27: School Registration Application

What was easy?• Creating an E-R diagram felt more natural than UML

designs.• Entities (User, Course, Assignment) were all well

defined, so it was easy to build relationships with one another.

• Building a method to re-create the tables and test data.• This allowed us to test, make changes, and re-set

the data as often as possible.• Once the methods were finalized and tested, it was easy

to build a GUI around them.• Apache Tomcat – Application container to hold the

deployable.• Website: http://tomcat.apache.org/

• Bootstrap – Open source tool using CSS and JavaScript routines to make basic HTML elements look nice.• Website: http://getbootstrap.com/

• Java Servlet Pages – Making HTML pages interactive by including Java’s Model-View-Controller pattern.

Page 28: School Registration Application

What was hard?• The SQL queries can sometimes be tricky:

• Many times, there is more than one way to get the data:• Subselects• Join statements• Where a=b clauses

• Deleting students should also delete their assignments; or else those FKs will be lost in the table.

• Initial Servlet work was hard, although MVC is easy to pick up once you get started.