Skip to content

Commit fc3cf3e

Browse files
authored
Merge branch 'master' into quality-of-life
2 parents 39291ef + 0e68569 commit fc3cf3e

File tree

7 files changed

+51
-33
lines changed

7 files changed

+51
-33
lines changed

application/controllers/allCont/ChemTableController.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ def ChemTable():
2121
if userLevel == -1 or user == -1:
2222
abort(403)
2323
print user.username, userLevel
24-
25-
chemicals = getChemicals() #Get all chemicals from the database
26-
contDict = contCount(chemicals)
27-
24+
25+
contDict = contCount(getChemicals())
26+
containers = getAllDataAboutContainers()
27+
2828
return render_template("views/ChemTableView.html",
2929
config = config,
30-
chemicals = chemicals,
30+
containers = containers,
3131
contDict = contDict,
3232
quote = quote,
3333
authLevel = userLevel)

application/models/containersModel.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
from application.models.chemicalsModel import Chemicals
33
from application.models.storagesModel import Storages
44
from application.models.roomsModel import *
5+
from application.models.roomsModel import Rooms
6+
from application.models.storagesModel import Storages
7+
from application.models.floorsModel import Floors
8+
from application.models.buildingsModel import Buildings
59
import datetime
610

11+
712
class Containers (Model):
813
conId = PrimaryKeyField()
914
##Foreign Keys
@@ -118,7 +123,7 @@ def getContainers(storage):
118123
Containers.get(Containers.storageId == storage,
119124
Containers.disposalDate == None)
120125
except Exception as e:
121-
return False
126+
return False
122127

123128
def disposeContainer(bId):
124129
try:
@@ -129,3 +134,11 @@ def disposeContainer(bId):
129134
except Exception as e:
130135
return (False, "Container "+ bId +" was could not be removed!", "list-group-item list-group-item-danger")
131136

137+
def getAllDataAboutContainers():
138+
conts = (Containers.select() \
139+
.join(Chemicals, on = (Containers.chemId == Chemicals.chemId)) \
140+
.join(Storages, on = (Containers.storageId == Storages.sId)) \
141+
.join(Rooms, on = (Rooms.rId == Storages.roomId)) \
142+
.join(Floors, on = (Floors.fId == Rooms.floorId)) \
143+
.join(Buildings, on = (Buildings.bId == Floors.buildId)))
144+
return conts

application/queries/locationReportQueries.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def getChemInLoc(loc_data):
2020
for value in loc_data:
2121
if (loc_data[value] != "*") and (value in loc_cons):
2222
wheres &= eval(loc_cons[value])
23-
elif value in haz_cons:
23+
elif value in haz_cons:
2424
haz_where |= eval(haz_cons[value])
2525
else:
2626
#No conditional provided
@@ -82,4 +82,3 @@ def getIAFlamLiquids():
8282
.where((Chemicals.flashPoint < 73) & (Chemicals.boilPoint < 100))) \
8383
.switch(Containers)
8484
return allIAFlam
85-

application/static/js/local/chemFile.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
var table;
22
var cookie;
3+
34
function createTable(){
45
table = $('#chemtable').DataTable({
56
"columnDefs": [
6-
{
7-
"targets": 'Barcodes',
8-
"visible": false
9-
},
10-
{
11-
"targets": 'nosort',
12-
"searchable": false
13-
}
14-
]
7+
{
8+
"targets": 'Barcodes',
9+
"visible": false
10+
},
11+
{
12+
"targets": 'nosort',
13+
"searchable": false
14+
}
15+
]
1516
});
1617
getCookie('savedSearch')
1718
addClearButton()
@@ -59,8 +60,8 @@ function getCookie(cname) {
5960
return true;
6061
}
6162
}
62-
}
63-
return "";
63+
}
64+
return "";
6465
}
6566

6667
function find_cookie ( cookie_name ){
@@ -91,7 +92,7 @@ function reload_table(cookie){
9192
}
9293

9394
function destroyCookie(cookieKey){
94-
95+
9596
document.cookie = cookieKey+"=; expires=Fri, 5 July 2017 12:00:00 UTC; path=/";
9697
reload_table("");
9798

application/templates/snips/ChemFile.html

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,26 @@ <h1>View All Chemicals</h1>
1212
<th>CAS Number</th>
1313
<th class="nosort">Color Code</th>
1414
<th class="nosort">In Stock</th>
15+
<th>Hazards</th>
16+
<th>Location</th>
1517
<th class="Barcodes">Barcodes</th>
1618
</tr>
1719
</thead>
18-
{% for chemical in chemicals %}
19-
{% if chemical.remove == False %}
20-
<tr onclick="cookieSaveAndRedirect('../ViewChemical/{{chemical.chemId}}/');"> {# The whole row is a link to the correct chemical page #}
21-
<td>{{chemical.name}}</td>
22-
<td>{{chemical.casNum}}</td>
23-
{% if config.hazards[chemical.primaryHazard] is defined %}
24-
<td>{{config.hazards[chemical.primaryHazard].hazardColor}}</td>
20+
{% for container in containers %}
21+
{% if container.chemId.remove == False %}
22+
<tr onclick="cookieSaveAndRedirect('../ViewChemical/{{container.chemId.chemId}}/');"> {# The whole row is a link to the correct chemical page #}
23+
<td>{{container.chemId.name}}</td>
24+
<td>{{container.chemId.casNum}}</td>
25+
{% if config.hazards[container.chemId.primaryHazard] is defined %}
26+
<td>{{config.hazards[container.chemId.primaryHazard].hazardColor}}</td>
2527
{% else %}
2628
<td>Not Available</td>
2729
{% endif %}
28-
<td>{{contDict[chemical.name] | length}}</td>
30+
<td>{{contDict[container.chemId.name] | length}}</td>
31+
<td>{{container.chemId.primaryHazard}}</td>
32+
<td>{{container.storageId.roomId.floorId.buildId.name}}-{{container.storageId.roomId.name}}</td>
2933
<td>
30-
{% for container in contDict[chemical.name] %}
34+
{% for container in contDict[container.chemId.name] %}
3135
{{container.barcodeId}}
3236
{% endfor %}
3337
</td>
@@ -36,9 +40,8 @@ <h1>View All Chemicals</h1>
3640
{%endfor%}
3741
<script>
3842
$(document).ready(createTable());
39-
43+
4044
</script>
4145
</table>
4246
</div>
4347
</div>
44-

config/config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ export:
129129

130130
DEBUG:
131131
user: "heggens" # default user - admin
132+
# user: "manalaih_ssdt"
132133
# user: "ballz" #admin
133134
# user: "hooverk" #systemAdmin
134135
# user: "thakurr" #superUser
135-
# user: "williamsk" #systemUser
136+
# user: "williamsk" #systemUser

config/roles.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
admin:
33
- ubuntu #For Testing
44
- hooverk
5-
- insengrim
5+
- insengrim
6+
- ramsayb2
67
# - database Roles
78

89
systemAdmin:

0 commit comments

Comments
 (0)