Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre v1.0 #114

Merged
merged 12 commits into from
Apr 12, 2024
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- run: npm --prefix storeQuestionService ci
- run: npm --prefix userStatsService ci
- run: npm --prefix gameservice ci
- run: npm --prefix gameservice ci
- run: npm --prefix users/authservice test -- --coverage
- run: npm --prefix users/userservice test -- --coverage
- run: npm --prefix gatewayservice test -- --coverage
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ jobs:
deploy:
name: Deploy over SSH
runs-on: ubuntu-latest
needs: [docker-push-userservice,docker-push-authservice,docker-push-gatewayservice,docker-push-webapp, docker-push-questiongeneratorservice, docker-push-storequestionservice, docker-push-userstatsservice, docker-push-wikidataextractorservice]
needs: [docker-push-userservice,docker-push-authservice,docker-push-gatewayservice,docker-push-webapp, docker-push-questiongeneratorservice, docker-push-storequestionservice, docker-push-userstatsservice, docker-push-wikidataextractorservice, docker-push-gameservice]
steps:
- name: Deploy over SSH
uses: fifsky/ssh-action@master
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
- "27017:27017"
networks:
- mynetwork
restart: always

mongodb_wiki:
container_name: mongodb-wiki-${teamname:-defaultASW}
Expand All @@ -21,6 +22,7 @@ services:
- "27018:27017"
networks:
- mynetwork
restart: always

authservice:
container_name: authservice-${teamname:-defaultASW}
Expand All @@ -35,6 +37,7 @@ services:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb
restart: always

userservice:
container_name: userservice-${teamname:-defaultASW}
Expand All @@ -49,6 +52,7 @@ services:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb
restart: always

gameservice:
container_name: gameservice-${teamname:-defaultASW}
Expand All @@ -64,6 +68,7 @@ services:
environment:
QUESTIONS_GENERATOR_SERVICE_URL: http://questiongeneratorservice:8007
STORE_STATS_SERVICE: http://userstatsservice:8003
restart: always

questiongeneratorservice:
container_name: questiongeneratorservice-${teamname:-defaultASW}
Expand All @@ -80,6 +85,7 @@ services:
environment:
MONGODB_URI: mongodb://mongodb_wiki:27017/questions
STORE_QUESTION_SERVICE_URL: http://storequestionservice:8004
restart: always

wikidataextractorservice:
container_name: wikidataextractorservice-${teamname:-defaultASW}
Expand All @@ -94,6 +100,7 @@ services:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb_wiki:27017/questions
restart: always

gatewayservice:
container_name: gatewayservice-${teamname:-defaultASW}
Expand All @@ -115,6 +122,7 @@ services:
STORE_QUESTION_SERVICE_URL: http://storequestionservice:8004
QUESTIONS_GENERATOR_SERVICE_URL: http://questiongeneratorservice:8007
GAME_SERVICE_URL: http://gameservice:8005
restart: always


webapp:
Expand All @@ -126,6 +134,7 @@ services:
- gatewayservice
ports:
- "3000:3000"
restart: always

prometheus:
image: prom/prometheus
Expand Down Expand Up @@ -173,6 +182,7 @@ services:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/storedquestion
restart: always

userstatsservice:
container_name: userstats-${teamname:-defaultASW}
Expand All @@ -187,6 +197,7 @@ services:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/statsdb
restart: always


volumes:
Expand Down
16 changes: 11 additions & 5 deletions questionsservice/questiongeneratorservice/questiongenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,27 @@ class QuestionGenerator {

static temas = new Map([
["paises", [0, 1, 2]],
['capital', [0]],
["lenguaje", [1]]
['capital', [0, 1]],
["lenguaje", [2]]
]);
;

static plantillas = [
{
pregunta: (param) => `¿Cual es la capital de ${param}?`,
filtro: { capital: { $exists: true } },
pregunta: (param) => `¿Cuál es la capital de ${param}?`,
filtro: { pais: { $exists: true }, capital: { $exists: true } },
campo_pregunta: 'pais',
campo_respuesta: 'capital'
},
{
pregunta: (param) => `¿De qué país es capital ${param}?`,
filtro: { capital: { $exists: true }, pais: { $exists: true } },
campo_pregunta: 'capital',
campo_respuesta: 'pais'
},
{
pregunta: (param) => `¿Qué lengua se habla en ${param}?`,
filtro: { lenguaje: { $exists: true } },
filtro: { pais: { $exists: true }, lenguaje: { $exists: true } },
campo_pregunta: 'pais',
campo_respuesta: 'lenguaje'
}
Expand Down
2 changes: 1 addition & 1 deletion userStatsService/user-stats-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ app.get('/history/games/:username', async (req, res) => {
questions: user.questions,
createdAt: user.createdAt
}));
res.json(userInformation.slice(0, req.query.limit || userInformation.length));
res.json(userInformation.slice(0, req.query.limit || userInformation.length).reverse());
} else {
res.status(404).json({ error: 'User not found!' });
}
Expand Down
20 changes: 8 additions & 12 deletions webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions webapp/src/components/FirstGame.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
border-image: linear-gradient(to bottom, rgba(0, 255, 0,var(--border-alpha)), rgba(0, 0, 255,var(--border-alpha))) 1;
}

.questionStructure h1{
justify-content: center;
color: #F0F0F0;
}

.questionStructure .answers {
display: flex;
justify-content: center; /* Alinea los elementos en el centro horizontal /
Expand All @@ -34,13 +39,21 @@
grid-template-columns: auto auto;
}

.allAnswers > div{
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}

.asnwers {
width:100%;
}


.questionFirstGame {
height: 100%;
width: 100%;
display: inline-block;
}

Expand Down
Loading