Skip to content

Commit

Permalink
Add turn name to log download. Fix empty team interface. Remove manda…
Browse files Browse the repository at this point in the history
…tory gender.
  • Loading branch information
sonsoleslp committed Apr 27, 2021
1 parent 5fa3793 commit 16cc7af
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 12 deletions.
5 changes: 2 additions & 3 deletions controllers/analytics_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ exports.downloadRaw = async (req, res) => {
const {escapeRoom, query} = req;
const {turnId} = query;

console.log(req.query);
try {
escapeRoom.puzzles = await getERPuzzles(escapeRoom.id);
const puzzleIdToOrder = {};
Expand All @@ -562,12 +561,12 @@ exports.downloadRaw = async (req, res) => {
for (const team of teams) {
const {id, name, teamMembers, requestedHints, retos} = team;
const startTime = team.turno.startTime || team.startTime;
const teamSize = teamMembers.length;
const logBase = {
"teamId": id,
"teamName": name,
teamSize,
"teamSize": teamMembers.length,
"turnoId": team.turno.id,
"turnoTag": team.turno.place,
"startTime": convertDate(startTime),
"timestamp": "",
"minute": "",
Expand Down
5 changes: 3 additions & 2 deletions helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,9 @@ exports.areHintsAllowedForTeam = async (teamId, hintLimit) => {
return {hintsAllowed, successHints, failHints};
};

exports.getContentForPuzzle = (content = [], currentlyWorkingOn) => JSON.parse(content).map((block, index) => ({...block, index})).filter((block) => block.puzzles.indexOf(currentlyWorkingOn.toString()) !== -1);

exports.getContentForPuzzle = (content = "[]", currentlyWorkingOn) => {
return JSON.parse(content || "[]").map((block, index) => ({...block, index})).filter((block) => block.puzzles.indexOf(currentlyWorkingOn.toString()) !== -1);
}
exports.paginate = (page = 1, pages, limit = 5) => {
let from = 0;
let to = 0;
Expand Down
2 changes: 2 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
},
"common": {
"accept": "accept",
"author": "author",
"back": "back",
"cancel": "cancel",
"confirm": "confirm",
Expand Down Expand Up @@ -227,6 +228,7 @@
},
"next": "next",
"save": "save",
"see": "see",
"orderBy": "Order by",
"previous": "back",
"profile": "Profile",
Expand Down
2 changes: 2 additions & 0 deletions i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
},
"common": {
"accept": "aceptar",
"author": "autor",
"back": "volver",
"cancel": "cancelar",
"confirm": "confirmar",
Expand Down Expand Up @@ -225,6 +226,7 @@
"orderBy": "Ordenar por",
"previous": "anterior",
"profile": "Mi perfil",
"see": "ver",
"total": "total",
"Total": "Total",
"save": "guardar"
Expand Down
3 changes: 1 addition & 2 deletions models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ module.exports = function (sequelize, DataTypes) {
"gender": {
"type": DataTypes.STRING,
"validate": {
"len": [0, 200],
"notEmpty": {"msg": "Gender must not be empty."}
"len": [0, 200]
}
},
"username": {
Expand Down
7 changes: 7 additions & 0 deletions public/stylesheets/escapeRoomShow.sass
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#mainSection
.main.escapeRoomShow
background: none
.by-author
font-family: Lato, sans-serif
font-size: 20px
padding: 0px 10px 0px 10px
margin-top: -10px
a
cursor: pointer
.menuERShow
display: flex
.menuERShowRight
Expand Down
7 changes: 7 additions & 0 deletions public/stylesheets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,13 @@ body .daterangepicker {

#mainSection .main.escapeRoomShow {
background: none; }
#mainSection .main.escapeRoomShow .by-author {
font-family: Lato, sans-serif;
font-size: 20px;
padding: 0px 10px 0px 10px;
margin-top: -10px; }
#mainSection .main.escapeRoomShow .by-author a {
cursor: pointer; }
#mainSection .main.escapeRoomShow .menuERShow {
display: flex; }
#mainSection .main.escapeRoomShow .menuERShow .menuERShowRight {
Expand Down
7 changes: 4 additions & 3 deletions seeders/20190208221150-FillEscapeRoomsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ module.exports = {
up (queryInterface) {
return queryInterface.bulkInsert("escapeRooms", [
{
"title": "Escape Room IWEB 2018-React Redux",
"subject": "IWEB",
"title": "My first escape room",
"subject": "Programming",
"duration": 120,
"description": "Escape room educativa sobre React y Redux en la que los alumnos tendrán que encontrar los errores en el código que les damos.",
"description": "Educational escape room",
"teamSize": 2,
"invitation": "assfdtWeQv",
"teamInstructions": '[{"type":"text","puzzles":["0","all"],"payload":{"text":"You can add a custom message, images, links... Do not forget to setup when you want to display this information by clicking in the eye icon on the left.</p>\n"}}]',
"authorId": 1,
"scoreParticipation": 40,
"createdAt": new Date(),
Expand Down
3 changes: 3 additions & 0 deletions views/escapeRooms/show.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
</div>
<br class="escapeRoomItem">
<h1><%=i18n.escapeRoom.steps.edit.title%>:</h1>
<%if (session.user.isAdmin){%>
<h2 class="by-author"><%=i18n.common.see%> <a href="/users/<%=escapeRoom.authorId%>"><%=i18n.common.author%></a></h2>
<%}%>

<div class="menuERShow">
<div class="menuERShowLeft">
Expand Down
4 changes: 2 additions & 2 deletions views/users/_form.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<br />
<div class="userField">
<label for="gender"><span><%=i18n.user.gender%></span>
<select required class="customInput" id="gender" name="gender" value="<%= user.gender %>" placeholder="<%=i18n.user.inputs.genderPlaceHolder %>" autocomplete="off">
<option value disabled <%= !user.id ? "selected" : ""%>/>
<select class="customInput" id="gender" name="gender" value="<%= user.gender %>" placeholder="<%=i18n.user.inputs.genderPlaceHolder %>" autocomplete="off">
<option value <%= user.gender ? "" : "selected" %> <%= !user.id ? "selected" : ""%>/>
<option value="Femenino" <%= user.gender === "Femenino" ? "selected" : ""%>>Mujer</option>
<option value="Masculino" <%= user.gender === "Masculino" ? "selected" : ""%>>Hombre</option>
<option value="Otro" <%= user.gender === "Otro" ? "selected" : ""%>>Otro</option>
Expand Down

0 comments on commit 16cc7af

Please sign in to comment.