diff --git a/docs/brainstorm/Feedback.md b/docs/brainstorm/Feedback.md index 6bed684..84428c0 100644 --- a/docs/brainstorm/Feedback.md +++ b/docs/brainstorm/Feedback.md @@ -36,7 +36,14 @@ The design will be updated to include: `Remove the lamps on top of the node for less distraction. ### Design questions led by bram -We have a wooden and plastic design. We were wondering wich one is more easy to look at, and wich one can be more distracting. +For the nodes we designed to be placed around the 5th floor we were stuck between two designs: +The wooden design: takes less time to create,is more fragile, and more eco-friendly. +The Plastic: less eco-friendly, takes a longer time, looks objectively better. + +since we can't decide on what we should use, I (Bram) went out to asks the public for their opinion. + +To do this i took the front of the plastic design, and the front of the wooden design. +They lloked like this: 1. which design is more likable diff --git a/server/data.py b/server/data.py index a863857..3157c8a 100644 --- a/server/data.py +++ b/server/data.py @@ -37,13 +37,13 @@ async def processEnqueteNodeData(data, nodeID): mydb = dbLogin() cursor = mydb.cursor() - query = "INSERT INTO `Response` (Node_NodeID, Question_QuestionID, Response) VALUES (%s, %s, %s)" + query = "INSERT INTO `Reply` (Result, Node_NodeID, Question_QuestionID) VALUES (%s, %s, %s)" processedData = json.loads(data) processedQuestionID = (processedData['QuestionID']) processedResponse = (processedData['Response']) - pushingDataArray = [(nodeID, processedQuestionID, processedResponse)] + pushingDataArray = [(processedResponse, nodeID, processedQuestionID)] for i in pushingDataArray: cursor.execute(query, i) @@ -54,8 +54,6 @@ async def processEnqueteNodeData(data, nodeID): cursor.close() mydb.close() - - async def receive_data(): uri = "ws://145.92.8.114/ws" try: @@ -67,8 +65,11 @@ async def receive_data(): processedData = json.loads(data) macAdress = processedData['node'] - type = await getNodeType(macAdress) - + if "Temp" in processedData: + type = 'sensor' + else: + type = 'enquete' + await getNodeInfo('sensor') await getNodeInfo('enquete') @@ -135,20 +136,11 @@ async def getNodeID(macAdress): cursor.execute("""SELECT nodeID FROM Node WHERE MAC = %s""", id) data = cursor.fetchall() - nodeID = data[0][0] + for tuples in data: + for item in tuples: + nodeID = item return nodeID - -async def getNodeType(macAdress): - id = (macAdress,) - mydb = dbLogin() - cursor = mydb.cursor() - cursor.execute("""SELECT Type FROM Node WHERE MAC = %s""", id) - data = cursor.fetchall() - - Type = data[0][0] - - return Type async def newNode(mac, type): id = (mac, type,) @@ -159,5 +151,4 @@ async def newNode(mac, type): print("new node assigned") mydb.commit() -asyncio.run(main()) - +asyncio.run(main()) \ No newline at end of file