Skip to content

Commit

Permalink
added new db table, matches, changed db version for changes to have e…
Browse files Browse the repository at this point in the history
…ffect
  • Loading branch information
joypan1 committed Mar 14, 2024
1 parent 08a39e4 commit ed16527
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const db = new Dexie("Team Tracking App");
//trap was in there twice throwing errors so I removed the last one of them (2nd to last entry)
db.version(1).stores({ teams: "++id, teamname, globalid, rank, teamnumber, teamschool, alliancescore, moreinfo, startingpos, Leaveszone, scores1amp, scores1speaker, picksup, scores2amp, scores2speaker, preferredScoringMethod, preferredIntakeMethod, prefintake, spotlight, trap, alone, hangsWithAnother, attemptsSpotlight, coop, matchnumber, count1, count2, count3, count4, count5, count6, count7, stage, hangs, harmony, otherinfo" });

db.version(2).stores({
teams: "++id, teamname, globalid, teamnumber, teamschool, alliancescore, moreinfo, startingpos, Leaveszone, scores1amp, scores1speaker, picksup, scores2amp, scores2speaker, preferredScoringMethod, preferredIntakeMethod, prefintake, spotlight, trap, alone, hangsWithAnother, attemptsSpotlight, coop",
matches: "++id, rank, matchnumber, count1, count2, count3, count4, count5, count6, count7, stage, hangs, harmony, otherinfo"
});
// Version numbers must be changed whenever database objects (schema) are edited? See "Modify Schema" in https://dexie.org/docs/Tutorial/Understanding-the-basics


const form = document.querySelector("#new-team-form");
const input = document.querySelector("#new-team-input");
Expand Down
14 changes: 10 additions & 4 deletions pages/matchinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,13 @@ plusBtn7.addEventListener('click', function() {
// DATABASE ---------------------------------------------------------------

const db = new Dexie("Team Tracking App");
db.version(1).stores({ teams: "++id, teamname, globalid, rank, teamnumber, teamschool, alliancescore, moreinfo, startingpos, Leaveszone, scores1amp, scores1speaker, picksup, scores2amp, scores2speaker, preferredScoringMethod, preferredIntakeMethod, prefintake, spotlight, trap, alone, hangsWithAnother, attemptsSpotlight, coop, matchnumber, count1, count2, count3, count4, count5, count6, count7, stage, hangs, harmony, trap, otherinfo"});
// db = database
// teams = table in database db
db.version(2).stores({
teams: "++id, teamname, globalid, teamnumber, teamschool, alliancescore, moreinfo, startingpos, Leaveszone, scores1amp, scores1speaker, picksup, scores2amp, scores2speaker, preferredScoringMethod, preferredIntakeMethod, prefintake, spotlight, trap, alone, hangsWithAnother, attemptsSpotlight, coop",
matches: "++id, rank, matchnumber, count1, count2, count3, count4, count5, count6, count7, stage, hangs, harmony, otherinfo"
});
// Version numbers must be changed whenever database objects (schema) are edited? See "Modify Schema" in https://dexie.org/docs/Tutorial/Understanding-the-basics
// db = database
// teams = table in database db

/* Steps to submitting data (theoretically)
1. Input information in match form, press the submit button
Expand All @@ -163,7 +167,9 @@ const teamnumber = document.getElementById("teamnumber").value;
// in order to submit match data for a specific team from the general match info page,
// you need to get the globalid of an existing, matching team entry with the teamnumber submitted on matchinfo.html?

//const globalid = ????
const teamsDB = db.teams.toArray();
console.log(teamsDB);
//const globalid = ;


//insert team data
Expand Down
7 changes: 6 additions & 1 deletion pages/teamdetails.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// Global Dexie database initialization
const db = new Dexie("Team Tracking App");
db.version(1).stores({ teams: "++id, teamname, globalid, rank, teamnumber, teamschool, alliancescore, moreinfo, startingpos, Leaveszone, scores1amp, scores1speaker, picksup, scores2amp, scores2speaker, preferredScoringMethod, preferredIntakeMethod, prefintake, spotlight, trap, alone, hangsWithAnother, attemptsSpotlight, coop, matchnumber, count1, count2, count3, count4, count5, count6, count7, stage, hangs, harmony, otherinfo" });
db.version(2).stores({
teams: "++id, teamname, globalid, teamnumber, teamschool, alliancescore, moreinfo, startingpos, Leaveszone, scores1amp, scores1speaker, picksup, scores2amp, scores2speaker, preferredScoringMethod, preferredIntakeMethod, prefintake, spotlight, trap, alone, hangsWithAnother, attemptsSpotlight, coop",
matches: "++id, rank, matchnumber, count1, count2, count3, count4, count5, count6, count7, stage, hangs, harmony, otherinfo"
});
// Version numbers must be changed whenever database objects (schema) are edited? See "Modify Schema" in https://dexie.org/docs/Tutorial/Understanding-the-basics


document.addEventListener('DOMContentLoaded', async () => {
try {
Expand Down

0 comments on commit ed16527

Please sign in to comment.