Skip to content

Commit d7ececf

Browse files
author
circuits
committed
This is the commit for the first revision of the full working code
::
1 parent 635db24 commit d7ececf

File tree

2,176 files changed

+378164
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,176 files changed

+378164
-0
lines changed

.idea/WebApp.iml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 109 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ExerciseManager.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
2+
import mysql.connector
3+
import numpy
4+
5+
class Exercise :
6+
7+
def __init__(self,id,cirid,types,comp,correct,w):
8+
self.id = id
9+
self.cirid = cirid
10+
self.types = types
11+
self.comp = comp
12+
self.correct = correct
13+
self.w = w
14+
15+
def detail(self,detail):
16+
self.detail = detail
17+
18+
def path(self,img):
19+
self.img = img
20+
21+
22+
def genindex():
23+
mydb = mysql.connector.connect(
24+
host="localhost",
25+
user="root",
26+
database="CIRCUITDB"
27+
)
28+
29+
print(mydb)
30+
31+
exlist = []
32+
exercises = mydb.cursor()
33+
34+
exercises.execute("Select * from EXERCISE")
35+
36+
for x in exercises:
37+
# print(x)
38+
id = x[0]
39+
cirid = x[1]
40+
types = x[2]
41+
comp = x[3]
42+
correct = x[4]
43+
w = []
44+
w.append(x[5])
45+
w.append(x[6])
46+
w.append(x[7])
47+
e = Exercise(id, cirid, types, comp, correct, w)
48+
exlist.append(e)
49+
# print(exlist[0])
50+
51+
# matching exercise with circuit info
52+
circuit = mydb.cursor()
53+
print(len(exlist))
54+
for x in range(0, len(exlist)):
55+
circuit.execute("Select * from CIRCUIT Where ID='" + str(exlist[x].cirid) + "'")
56+
result = circuit.fetchall()
57+
tmpex = exlist[x]
58+
a = result[0]
59+
tmpex.detail(a[3])
60+
tmpex.path(a[2])
61+
62+
exlist[x] = tmpex
63+
64+
return exlist
65+
66+
def createQuestion(exercise):
67+
print(exercise.types)
68+
quest='Calculate the '
69+
if exercise.types=='V':
70+
quest+='voltage drop in'
71+
elif exercise.types=='I':
72+
quest+='drawn current in'
73+
else:
74+
quest+='power of'
75+
76+
77+
quest+=' '+exercise.comp+'.'
78+
79+
return quest
80+
81+
82+
83+
84+
85+
86+
#saves exercises
87+
1.58 KB
Binary file not shown.
1.88 KB
Binary file not shown.

ele_logo.png

5.06 MB
Loading

exercise.html

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!DOCTYPE html>
2+
3+
<html lang="en">
4+
<head>
5+
<meta charset = "utf-8">
6+
<title> Electonics Learning Ecosystem</title>
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
9+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
10+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
11+
</head>
12+
<body>
13+
<nav class="navbar navbar-inverse">
14+
<div class="container-fluid">
15+
<div class="navbar-header">
16+
<a class="navbar-brand" href="#">ELE</a>
17+
</div>
18+
<ul class="nav navbar-nav">
19+
<li class="active"><a href="#">Home</a></li>
20+
<li><a href="/Exercises">Exercises</a></li>
21+
</ul>
22+
<ul class="nav navbar-nav navbar-right" >
23+
<li><a href="/form">Login</a></li>
24+
<li><a href="#">Register</a></li>
25+
</ul>
26+
</div>
27+
</nav>
28+
<div class="container-fluid">
29+
30+
<div class="row">
31+
<div class="col-sm-4"></div>
32+
<div class="col-sm-8">
33+
<h1>Lista de Exercicios Disponiveis</h1>
34+
<form method="post" action="Exercisees">
35+
<button type="submit" value="1" name="value" class="btn btn-primary">Give it now!</button>
36+
</form>
37+
</div>
38+
<div class="col-sm-2"></div>
39+
</div>
40+
</div>
41+
42+
43+
44+
</body>
45+
</html>

0 commit comments

Comments
 (0)