Skip to content

Commit

Permalink
Merge pull request #3 from bflanagin/lessonPlans
Browse files Browse the repository at this point in the history
Finished Lesson Plan creation
  • Loading branch information
Ben Flanagin committed Jun 10, 2018
2 parents 4f8cb82 + d8abc23 commit dd92799
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 64 deletions.
30 changes: 30 additions & 0 deletions Desktop/CourseDashBoard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ id:thisWindow

property real coursenumber: 0
property string courseName: "Course Name"
property string courseAbout: "About"
property string courseSubject: "Subject"
property string courseDate:""

states: [

Expand Down Expand Up @@ -141,6 +144,33 @@ property string courseName: "Course Name"
width: parent.width
spacing: mainView.width * 0.01

ESborder {
anchors.horizontalCenter: parent.horizontalCenter
width:thisWindow.width * 0.98
height:about.height + 100
Text {
id:about
anchors.top:parent.top
anchors.left:parent.left
anchors.margins: 20
text:courseAbout
wrapMode: Text.WordWrap
width:parent.width * 0.85
}

Text {
anchors.bottom:parent.bottom
anchors.right:parent.right
anchors.margins: 20
text:courseSubject
}
Text {
anchors.top:parent.top
anchors.right:parent.right
anchors.margins: 20
text:courseDate
}
}

ListView {
anchors.horizontalCenter: parent.horizontalCenter
Expand Down
13 changes: 12 additions & 1 deletion Desktop/EducatorUI.qml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ Item {
}


Timer {
id:checkforUpdates
interval: 4000
repeat: true
onTriggered: if(state == "Active") {
Network.sync("Courses",schoolCode)
Network.sync("Units",schoolCode)
Network.sync("Lessons",schoolCode)
checkforUpdates.interval = 20000
}
}


Rectangle {
anchors.fill: parent
Expand Down Expand Up @@ -268,7 +280,6 @@ Item {
}
Button {
height:parent.height
//width:parent.height
text: "Add"
background: ESTextField{}
onClicked: {newStudent.state = "Active" }
Expand Down
10 changes: 5 additions & 5 deletions Desktop/OSAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@ function account_type(userid) {
function save_local(userid,type,firstname,lastname,email,phone,country,state,about,teachercode) {



var d = new Date()


db.transaction(function (tx){
var data = [userid,type,firstname,lastname,email,phone,country,state,about,teachercode];
var dtable = "INSERT INTO Users VALUES(?,?,?,?,?,?,?,?,?,?)"
var update = "UPDATE Users SET type="+type+", firstname='"+firstname+"', lastname='"+lastname+"', email='"+email+"', phone='"+phone+"', country='"+country+"', state='"+state+"', about='"+about+"' WHERE id='"+userid+"'"
var data = [userid,type,firstname,lastname,email,phone,country,state,about,teachercode,d.getTime()];
var dtable = "INSERT INTO Users VALUES(?,?,?,?,?,?,?,?,?,?,?)"
var update = "UPDATE Users SET type="+type+", firstname='"+firstname+"', lastname='"+lastname+"', email='"+email+"', phone='"+phone+"', country='"+country+"', state='"+state+"', about='"+about+"', editdate="+d.getTime()+" WHERE id='"+userid+"'"

tx.executeSql('CREATE TABLE IF NOT EXISTS Users (id TEXT, type INT,firstname TEXT,lastname TEXT,email TEXT,phone TEXT,country TEXT,state TEXT,about MEDIUMTEXT,code TEXT)')
tx.executeSql('CREATE TABLE IF NOT EXISTS Users (id TEXT, type INT,firstname TEXT,lastname TEXT,email TEXT,phone TEXT,country TEXT,state TEXT,about MEDIUMTEXT,code TEXT,editdate MEDIUMINT)')

var dataSTR = "SELECT * FROM Users WHERE id ='"+userid+"'";

Expand Down
2 changes: 1 addition & 1 deletion Desktop/SchoolWizard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ ESborder {
background: ESTextField {
}
placeholderText: qsTr("Enter School Code")
onTextChanged: Network.retrieveFromOpenSeed(text, "School")
onTextChanged: Network.retrieveFromOpenSeed(text, text, "School")
}

Row {
Expand Down
40 changes: 18 additions & 22 deletions Desktop/course.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ function saveCourse(userid,name,subject,language,about,creationdate) {

db.transaction(function (tx){
var data = [userid,name.replace(/ /g,"_"),subject.split(" - ")[0],language,about,d.getTime()];
var dtable = "INSERT INTO Courses VALUES(?,?,?,?,?,?)"
// var update = "UPDATE Courses SET name='"+name.replace(/ /g,"_")+"', subject='"+subject.split(" - ")[0]+"', language='"+language+"', about='"+about+"' WHERE id='"+userid+"' AND creationdate ="+creationdate
var dtable = "INSERT INTO Courses VALUES(?,?,?,?,?,?,?)"

tx.executeSql('CREATE TABLE IF NOT EXISTS Courses (id TEXT, name TEXT, subject TEXT,language TEXT, about MEDIUMTEXT, creationdate MEDIUMINT)')
tx.executeSql('CREATE TABLE IF NOT EXISTS Courses (id TEXT, name TEXT, subject TEXT,language TEXT, about MEDIUMTEXT, creationdate MEDIUMINT,editdate MEDIUMINT)')

var dataSTR = "SELECT * FROM Courses WHERE id ='"+userid+"' AND creationdate ="+creationdate;

var pull = tx.executeSql(dataSTR);
if(pull.rows.length !== 1) {
tx.executeSql(dtable,data);
} else {
// tx.executeSql(update);
}

});
Expand All @@ -27,18 +24,15 @@ function saveUnit(userid,coursenumber,name,objective,about,creationdate) {

db.transaction(function (tx){
var data = [userid,coursenumber,name.replace(/ /g,"_"),objective,about,d.getTime()];
var dtable = "INSERT INTO Units VALUES(?,?,?,?,?,?)"
// var update = "UPDATE Units SET name='"+name.replace(/ /g,"_")+"', objective='"+objective+"', about='"+about+"' WHERE id='"+userid+"' AND creationdate ="+creationdate
var dtable = "INSERT INTO Units VALUES(?,?,?,?,?,?,?)"

tx.executeSql('CREATE TABLE IF NOT EXISTS Units (id TEXT, coursenumber MEDIUMINT, name TEXT, objective MEDIUMTEXT, about MEDIUMTEXT, creationdate MEDIUMINT)')
tx.executeSql('CREATE TABLE IF NOT EXISTS Units (id TEXT, coursenumber MEDIUMINT, name TEXT, objective MEDIUMTEXT, about MEDIUMTEXT, creationdate MEDIUMINT,editdate MEDIUMINT)')

var dataSTR = "SELECT * FROM Units WHERE id ='"+userid+"' AND creationdate ="+creationdate;

var pull = tx.executeSql(dataSTR);
if(pull.rows.length !== 1) {
tx.executeSql(dtable,data);
} else {
// tx.executeSql(update);
}

});
Expand All @@ -51,19 +45,16 @@ function saveLesson(userid,coursenumber,unitnumber,name,lessonNum,duration,about

db.transaction(function (tx){
var data = [userid,coursenumber,unitnumber,name.replace(/ /g,"_"),lessonNum,duration,about,objective,supplies,resources,guidingQuestions,lessonSequence,studentProduct,reviewQuestions,d.getTime()];
var dtable = "INSERT INTO Lessons VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
// var update = "UPDATE Lessons SET name='"+name.replace(/ /g,"_")+"', objective='"+objective+"', about='"+about+"' WHERE id='"+userid+"' AND creationdate ="+creationdate
var dtable = "INSERT INTO Lessons VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"

tx.executeSql('CREATE TABLE IF NOT EXISTS Lessons (id TEXT, coursenumber MEDIUMINT,unitnumber MEDIUMINT, name TEXT, lessonNum INT, duration INT, about MEDIUMTEXT, objective MEDIUMTEXT, supplies MEDIUMTEXT, resources MEDIUMTEXT, \
guidingQuestions MEDIUMTEXT, lessonSequence MEDIUMTEXT, studentProduct MEDIUMTEXT, reviewQuestions MEDIUMTEXT,creationdate MEDIUMINT)')
guidingQuestions MEDIUMTEXT, lessonSequence MEDIUMTEXT, studentProduct MEDIUMTEXT, reviewQuestions MEDIUMTEXT,creationdate MEDIUMINT,editdate MEDIUMINT)')

var dataSTR = "SELECT * FROM Lessons WHERE id ='"+userid+"' AND creationdate ="+creationdate;

var pull = tx.executeSql(dataSTR);
if(pull.rows.length !== 1) {
tx.executeSql(dtable,data);
} else {
// tx.executeSql(update);
}

});
Expand All @@ -73,7 +64,7 @@ guidingQuestions MEDIUMTEXT, lessonSequence MEDIUMTEXT, studentProduct MEDIUMTEX
function loadCourses(userid) {
db.transaction(function (tx){
courseList.clear();
tx.executeSql('CREATE TABLE IF NOT EXISTS Courses (id TEXT, name TEXT, subject TEXT,language TEXT, about MEDIUMTEXT, creationdate MEDIUMINT)')
tx.executeSql('CREATE TABLE IF NOT EXISTS Courses (id TEXT, name TEXT, subject TEXT,language TEXT, about MEDIUMTEXT, creationdate MEDIUMINT,editdate MEDIUMINT)')

var dataSTR = "SELECT * FROM Courses WHERE id ='"+userid+"'";

Expand Down Expand Up @@ -127,7 +118,7 @@ function loadUnits(userid,coursenumber) {

db.transaction(function (tx){
unitList.clear();
tx.executeSql('CREATE TABLE IF NOT EXISTS Units (id TEXT, coursenumber MEDIUMINT, name TEXT, objective MEDIUMTEXT, about MEDIUMTEXT, creationdate MEDIUMINT)')
tx.executeSql('CREATE TABLE IF NOT EXISTS Units (id TEXT, coursenumber MEDIUMINT, name TEXT, objective MEDIUMTEXT, about MEDIUMTEXT, creationdate MEDIUMINT,editdate MEDIUMINT)')

var dataSTR = "SELECT * FROM Units WHERE id ='"+userid+"' AND coursenumber ="+coursenumber;

Expand Down Expand Up @@ -156,7 +147,7 @@ function loadLessons(userid,unitnumber) {
db.transaction(function (tx){
lessonList.clear();
tx.executeSql('CREATE TABLE IF NOT EXISTS Lessons (id TEXT, coursenumber MEDIUMINT,unitnumber MEDIUMINT, name TEXT, lessonNum INT, duration INT, about MEDIUMTEXT, objective MEDIUMTEXT, supplies MEDIUMTEXT, resources MEDIUMTEXT, \
guidingQuestions MEDIUMTEXT, lessonSequence MEDIUMTEXT, studentProduct MEDIUMTEXT, reviewQuestions MEDIUMTEXT,creationdate MEDIUMINT)')
guidingQuestions MEDIUMTEXT, lessonSequence MEDIUMTEXT, studentProduct MEDIUMTEXT, reviewQuestions MEDIUMTEXT,creationdate MEDIUMINT,editdate MEDIUMINT)')

var dataSTR = "SELECT * FROM Lessons WHERE id ='"+userid+"' AND unitnumber ="+unitnumber;

Expand Down Expand Up @@ -188,7 +179,7 @@ function loadCourse(userid,coursenumber) {

db.transaction(function (tx){

tx.executeSql('CREATE TABLE IF NOT EXISTS Courses (id TEXT, name TEXT, subject TEXT,language TEXT, about MEDIUMTEXT, creationdate MEDIUMINT)')
tx.executeSql('CREATE TABLE IF NOT EXISTS Courses (id TEXT, name TEXT, subject TEXT,language TEXT, about MEDIUMTEXT, creationdate MEDIUMINT,editdate MEDIUMINT)')

var dataSTR = "SELECT * FROM Courses WHERE id ='"+userid+"' AND creationdate ="+coursenumber;

Expand All @@ -197,6 +188,9 @@ function loadCourse(userid,coursenumber) {
if(pull.rows.length === 1) {

courseName = pull.rows.item(0).name.replace(/_/g, " ")
courseAbout = pull.rows.item(0).about
courseSubject = pull.rows.item(0).subject
courseDate = new Date(pull.rows.item(0).creationdate).toLocaleDateString()


}
Expand All @@ -210,7 +204,7 @@ function loadUnit(userid,unitnumber) {

db.transaction(function (tx){

tx.executeSql('CREATE TABLE IF NOT EXISTS Units (id TEXT, coursenumber MEDIUMINT, name TEXT, objective MEDIUMTEXT, about MEDIUMTEXT, creationdate MEDIUMINT)')
tx.executeSql('CREATE TABLE IF NOT EXISTS Units (id TEXT, coursenumber MEDIUMINT, name TEXT, objective MEDIUMTEXT, about MEDIUMTEXT, creationdate MEDIUMINT,editdate MEDIUMINT)')


var dataSTR = "SELECT * FROM Units WHERE id ='"+userid+"' AND creationdate ="+unitnumber;
Expand All @@ -236,7 +230,7 @@ function loadLesson(userid,lessonnumber) {
db.transaction(function (tx){

tx.executeSql('CREATE TABLE IF NOT EXISTS Lessons (id TEXT, coursenumber MEDIUMINT,unitnumber MEDIUMINT, name TEXT, lessonNum INT, duration INT, about MEDIUMTEXT, objective MEDIUMTEXT, supplies MEDIUMTEXT, resources MEDIUMTEXT, \
guidingQuestions MEDIUMTEXT, lessonSequence MEDIUMTEXT, studentProduct MEDIUMTEXT, reviewQuestions MEDIUMTEXT,creationdate MEDIUMINT)')
guidingQuestions MEDIUMTEXT, lessonSequence MEDIUMTEXT, studentProduct MEDIUMTEXT, reviewQuestions MEDIUMTEXT,creationdate MEDIUMINT,editdate MEDIUMINT)')


var dataSTR = "SELECT * FROM Lessons WHERE id ='"+userid+"' AND creationdate ="+lessonnumber;
Expand Down Expand Up @@ -276,6 +270,8 @@ function editField(type,where,id,change) {
var table = ""
var field = ""

var d = new Date()


switch(type) {
case "Title": field = "name";break;
Expand Down Expand Up @@ -303,7 +299,7 @@ function editField(type,where,id,change) {
if(pull.rows.length === 1) {
console.log(pull.rows.item(0).name)

tx.executeSql("UPDATE "+table+" SET "+field+"='"+change+"' WHERE id ='"+userid+"' AND creationdate ="+id)
tx.executeSql("UPDATE "+table+" SET "+field+"='"+change+"', editdate="+d.getTime()+" WHERE id ='"+userid+"' AND creationdate ="+id)
}

})
Expand Down
8 changes: 4 additions & 4 deletions Desktop/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function loadschool(userid) {
db.transaction(function (tx) {


tx.executeSql('CREATE TABLE IF NOT EXISTS Schools (id TEXT, type INT,name TEXT,email TEXT,phone TEXT,country TEXT,state TEXT,about MEDIUMTEXT, code TEXT)')
tx.executeSql('CREATE TABLE IF NOT EXISTS Schools (id TEXT, type INT,name TEXT,email TEXT,phone TEXT,country TEXT,state TEXT,about MEDIUMTEXT, code TEXT,editdate MEDIUMINT)')

if(userid !== "") {
pull = tx.executeSql("SELECT * FROM Schools WHERE id='"+userid+"'");
Expand Down Expand Up @@ -49,7 +49,7 @@ function loaduser(userid) {
var exists = false;
db.transaction(function (tx) {

tx.executeSql('CREATE TABLE IF NOT EXISTS Users (id TEXT, type INT,firstname TEXT,lastname TEXT,email TEXT,phone TEXT,country TEXT,state TEXT,about MEDIUMTEXT, code TEXT)')
tx.executeSql('CREATE TABLE IF NOT EXISTS Users (id TEXT, type INT,firstname TEXT,lastname TEXT,email TEXT,phone TEXT,country TEXT,state TEXT,about MEDIUMTEXT, code TEXT,editdate MEDIUMINT)')


pull = tx.executeSql("SELECT * FROM Users WHERE id='"+userid+"'");
Expand Down Expand Up @@ -105,7 +105,7 @@ function oneTime(id,action,forwhat) {
db.transaction(function (tx) {


tx.executeSql('CREATE TABLE IF NOT EXISTS Schools (id TEXT, type INT,name TEXT,email TEXT,phone TEXT,country TEXT,state TEXT,about MEDIUMTEXT, code TEXT)')
tx.executeSql('CREATE TABLE IF NOT EXISTS Schools (id TEXT, type INT,name TEXT,email TEXT,phone TEXT,country TEXT,state TEXT,about MEDIUMTEXT, code TEXT,editdate MEDIUMINT)')

pull = tx.executeSql("SELECT * FROM Schools WHERE id='"+userid+"'");
if(pull.rows.length === 1) {
Expand All @@ -126,7 +126,7 @@ function oneTime(id,action,forwhat) {
db.transaction(function (tx) {


tx.executeSql('CREATE TABLE IF NOT EXISTS Users (id TEXT, type INT,name TEXT,email TEXT,phone TEXT,country TEXT,state TEXT,about MEDIUMTEXT, code TEXT)')
tx.executeSql('CREATE TABLE IF NOT EXISTS Users (id TEXT, type INT,name TEXT,email TEXT,phone TEXT,country TEXT,state TEXT,about MEDIUMTEXT, code TEXT,editdate MEDIUMINT)')

pull = tx.executeSql("SELECT * FROM Users WHERE id='"+userid+"'");
if(pull.rows.length === 1) {
Expand Down

0 comments on commit dd92799

Please sign in to comment.