Skip to content

Commit

Permalink
save plaintext for activity template too
Browse files Browse the repository at this point in the history
  • Loading branch information
cmayeux05 committed Sep 6, 2024
1 parent 6eb0513 commit b796890
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 5 deletions.
5 changes: 3 additions & 2 deletions client/src/Utils/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,12 +580,13 @@ export const updateSessionArduino = async(id, arduino) =>
error: 'stuff did not work lol'
});

export const updateDayArduino = async(id, arduino) =>
export const updateDayArduino = async(id, arduino,arduinoanswer) =>
makeRequest({
method: PUT,
path: `${server}/days/arduino/${id}`,
data: {
arduino
arduino,
arduinoanswer
},
auth: true,
error: 'stuff did not work lol'
Expand Down
2 changes: 1 addition & 1 deletion client/src/views/Researcher/dayz.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function CodeDayz() {
//console.log(response.data.template);

//console.log(getArduinoXML(response.data.template, workspaceRef.current));
updateDayArduino(parseInt(rID.value), getArduinoXML(response.data.template, workspaceRef.current))
updateDayArduino(parseInt(rID.value), getArduinoXML(response.data.template, workspaceRef.current), getArduinoXML(response.data.activity_template, workspaceRef.current))
.catch(error => {
console.log(error)
});
Expand Down
3 changes: 2 additions & 1 deletion server/api/day/controllers/day.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,12 @@ module.exports = {

async arduinoUpdate(ctx) {
const {id} = ctx.params;
const {arduino} = ctx.request.body;
const {arduino, arduinoanswer} = ctx.request.body;
const day = await strapi.services.day.findOne({ id });
//console.log(session)
//console.log(arduino)
day.template_code = arduino;
day.template_code_answer = arduinoanswer;
const updatedDay = await strapi.services.day.update({id}, day);
return updatedDay

Expand Down
6 changes: 6 additions & 0 deletions server/api/day/documentation/1.0.0/day.json
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,9 @@
"template_code": {
"type": "string"
},
"template_code_answer": {
"type": "string"
},
"blocks": {
"type": "array",
"items": {
Expand Down Expand Up @@ -993,6 +996,9 @@
"template_code": {
"type": "string"
},
"template_code_answer": {
"type": "string"
},
"blocks": {
"type": "array",
"items": {
Expand Down
4 changes: 4 additions & 0 deletions server/api/day/models/day.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
"type": "text",
"required": false
},
"template_code_answer": {
"type": "text",
"required": false
},
"blocks": {
"collection": "block"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,9 @@
"template_code": {
"type": "string"
},
"template_code_answer": {
"type": "string"
},
"blocks": {
"type": "array",
"items": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,9 @@
"template_code": {
"type": "string"
},
"template_code_answer": {
"type": "string"
},
"blocks": {
"type": "array",
"items": {
Expand Down
3 changes: 3 additions & 0 deletions server/api/save/documentation/1.0.0/save.json
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,9 @@
"template_code": {
"type": "string"
},
"template_code_answer": {
"type": "string"
},
"blocks": {
"type": "array",
"items": {
Expand Down
3 changes: 3 additions & 0 deletions server/api/submission/documentation/1.0.0/submission.json
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,9 @@
"template_code": {
"type": "string"
},
"template_code_answer": {
"type": "string"
},
"blocks": {
"type": "array",
"items": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"x-generation-date": "09/05/2024 8:56:36 PM"
"x-generation-date": "09/06/2024 9:04:56 PM"
},
"x-strapi-config": {
"path": "/documentation",
Expand Down Expand Up @@ -12577,6 +12577,9 @@
"template_code": {
"type": "string"
},
"template_code_answer": {
"type": "string"
},
"blocks": {
"type": "array",
"items": {
Expand Down Expand Up @@ -12678,6 +12681,9 @@
"template_code": {
"type": "string"
},
"template_code_answer": {
"type": "string"
},
"blocks": {
"type": "array",
"items": {
Expand Down Expand Up @@ -12971,6 +12977,9 @@
"template_code": {
"type": "string"
},
"template_code_answer": {
"type": "string"
},
"blocks": {
"type": "array",
"items": {
Expand Down Expand Up @@ -13110,6 +13119,9 @@
"template_code": {
"type": "string"
},
"template_code_answer": {
"type": "string"
},
"blocks": {
"type": "array",
"items": {
Expand Down Expand Up @@ -13453,6 +13465,9 @@
"template_code": {
"type": "string"
},
"template_code_answer": {
"type": "string"
},
"blocks": {
"type": "array",
"items": {
Expand Down Expand Up @@ -14560,6 +14575,9 @@
"template_code": {
"type": "string"
},
"template_code_answer": {
"type": "string"
},
"blocks": {
"type": "array",
"items": {
Expand Down

0 comments on commit b796890

Please sign in to comment.