Skip to content

Commit

Permalink
Merge pull request #98 from Full-Tortuga/release/v1.2.0
Browse files Browse the repository at this point in the history
Release/v1.2.0
  • Loading branch information
JSnow11 authored Jan 9, 2022
2 parents 449c5f3 + 45b9ad9 commit 91e3d17
Show file tree
Hide file tree
Showing 18 changed files with 1,524 additions and 81 deletions.
27 changes: 24 additions & 3 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ jobs:

services:
mongodb:
image: mongo:3.4.23
image: mongo
env:
MONGO_INITDB_DATABASE: decide
ports:
- 27017:27017
options: --health-cmd mongo --health-interval 10s --health-timeout 5s --health-retries 5

ldap:
image: carvilgar1us/decideldap
ports:
Expand All @@ -28,7 +32,7 @@ jobs:
- uses: actions/checkout@v2
- name: Install linux dependencies
run: |
sudo apt-get install build-essential python3-dev python2.7-dev libldap2-dev libsasl2-dev tox lcov valgrind
sudo apt-get install build-essential python3-dev python2.7-dev libldap2-dev libsasl2-dev tox lcov valgrind libpq-dev
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand All @@ -37,11 +41,28 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install codacy-coverage
- name: Copy local_settings
run: |
cp ./decide/local_settings.example.py ./decide/local_settings.py
- name: Migrate
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
run: |
cd decide
python manage.py flush --noinput
python manage.py sqlflush
python manage.py makemigrations
python manage.py migrate
- name: Test administration module
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
run: |
python ./decide/manage.py test administration
cd decide
coverage run --branch --source=./administration/ ./manage.py test --settings=decide.test_settings administration --noinput -v 2
coverage xml
- name: Codacy Coverage Reporter
uses: codacy/[email protected]
with:
project-token: ${{ secrets.CODACY_API_TOKEN }}
coverage-reports: decide/coverage.xml
34 changes: 34 additions & 0 deletions .github/workflows/react.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: React CI

on:
push:
branches: [master, main, develop]
pull_request:
branches: [master, main, develop]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: |
cd decide/administration/frontend &&
npm install
- name: Build app
run: |
cd decide/administration/frontend &&
npm run build --if-present
- name: Test app
run: |
cd decide/administration/frontend &&
npm run test
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[![Decide CI/CD](https://github.com/Full-Tortuga/decide-full-tortuga-autenticacion/actions/workflows/heroku.yml/badge.svg?branch=master)](https://github.com/Full-Tortuga/decide-full-tortuga-autenticacion/actions/workflows/heroku.yml)
[![Build Status](https://travis-ci.com/wadobo/decide.svg?branch=master)](https://travis-ci.com/wadobo/decide) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/94a85eaa0e974c71af6899ea3b0d27e0)](https://www.codacy.com/app/Wadobo/decide?utm_source=github.com&utm_medium=referral&utm_content=wadobo/decide&utm_campaign=Badge_Grade) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/94a85eaa0e974c71af6899ea3b0d27e0)](https://www.codacy.com/app/Wadobo/decide?utm_source=github.com&utm_medium=referral&utm_content=wadobo/decide&utm_campaign=Badge_Coverage)
[![Admin Build CI](https://github.com/Full-Tortuga/decide-full-tortuga-admin/actions/workflows/django.yml/badge.svg?branch=main)](https://github.com/Full-Tortuga/decide-full-tortuga-admin/actions/workflows/django.yml)
[![Admin Frontend CI](https://github.com/Full-Tortuga/decide-full-tortuga-admin/actions/workflows/react.yml/badge.svg?branch=main)](https://github.com/Full-Tortuga/decide-full-tortuga-admin/actions/workflows/react.yml)

[![Test Deployment CD](https://github.com/Full-Tortuga/decide-full-tortuga-admin/actions/workflows/herokuDevelop.yml/badge.svg?branch=main)](https://github.com/Full-Tortuga/decide-full-tortuga-admin/actions/workflows/herokuDevelop.yml)
[![Test Deployment CD](https://github.com/Full-Tortuga/decide-full-tortuga-admin/actions/workflows/herokuMain.yml/badge.svg?branch=main)](https://github.com/Full-Tortuga/decide-full-tortuga-admin/actions/workflows/herokuMain.yml)

[![Codacy Badge](https://app.codacy.com/project/badge/Grade/a9e07b14853a487d82a187bc69365d50)](https://www.codacy.com/gh/Full-Tortuga/decide-full-tortuga-admin/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Full-Tortuga/decide-full-tortuga-admin&utm_campaign=Badge_Grade)
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/a9e07b14853a487d82a187bc69365d50)](https://www.codacy.com/gh/Full-Tortuga/decide-full-tortuga-admin/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Full-Tortuga/decide-full-tortuga-admin&utm_campaign=Badge_Coverage)

Plataforma voto electrónico educativa

Expand Down
2 changes: 0 additions & 2 deletions decide/administration/frontend/src/api/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ axios.interceptors.response.use(
return response;
},
(error) => {
const message = error.response?.data?.message || error.message;
console.warn(message);
return Promise.reject(error);
}
);
6 changes: 3 additions & 3 deletions decide/administration/frontend/src/api/userApiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ const userApi = {
getUsers: () => axios.get("/users"),
deleteUsers: (idList: number[]) =>
axios.delete("/users", {
data: { idList: idList },
data: { idList },
}),

// bulk role/status operations
updateUsersActive: (idList: number[], value: boolean) =>
axios.post("/users/state", {
idList: idList,
idList,
state: "Active",
value: value ? "True" : "False",
}),
Expand All @@ -22,7 +22,7 @@ const userApi = {
role: "Staff" | "Superuser"
) =>
axios.post("/users/state", {
idList: idList,
idList,
state: role,
value: value ? "True" : "False",
}),
Expand Down
22 changes: 11 additions & 11 deletions decide/administration/frontend/src/api/votingApiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,54 +7,54 @@ const votingApi = {
getQuestions: () => axios.get("/voting/question"),
deleteQuestions: (idList: number[]) =>
axios.delete("/voting/questions", {
data: { idList: idList },
data: { idList },
}),
deleteAllQuestions: () => axios.delete(`/voting/question`),

//Individual Operations
getQuestion: (questionId: number) =>
axios.get(`/voting/question/${questionId}/`),
axios.get(`/voting/question/${questionId}`),
createQuestion: (question: votingType.Question) =>
axios.post("/voting/question/", question),
updateQuestion: (question: votingType.Question, questionId: number) =>
axios.put(`/voting/question/${questionId}/`, question),
axios.put(`/voting/question/${questionId}`, question),
deleteQuestion: (questionId: number) =>
axios.delete(`/voting/question/${questionId}/`),
axios.delete(`/voting/question/${questionId}`),

//VOTING API
//Bulk Operations
getVotings: () => axios.get(`/votings`),
deleteVotings: (idList: number[]) =>
axios.delete("/votings", {
data: { idList: idList },
data: { idList },
}),
deleteAllVotings: () => axios.delete(`/votings`),

startVotings: (idList: number[]) =>
axios.put("/votings", {
idList: idList,
idList,
action: "start",
}),

stopVotings: (idList: number[]) =>
axios.put("/votings", {
idList: idList,
idList,
action: "stop",
}),

tallyVotings: (idList: number[]) =>
axios.put("/votings", {
idList: idList,
idList,
action: "tally",
}),

//Individual Operations
getVoting: (votingId: number) => axios.get(`/votings/${votingId}/`),
getVoting: (votingId: number) => axios.get(`/votings/${votingId}`),
createVoting: (voting: votingType.VotingFormFields) =>
axios.post("/votings", voting),
updateVoting: (voting: votingType.VotingFormFields, votingId: number) =>
axios.put(`/votings/${votingId}/`, voting),
deleteVoting: (votingId: number) => axios.delete(`/votings/${votingId}/`),
axios.put(`/votings/${votingId}`, voting),
deleteVoting: (votingId: number) => axios.delete(`/votings/${votingId}`),
};

export default votingApi;
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const LoginPage = () => {
};

const onSubmit: SubmitHandler<LoginInputs> = (data) => {
console.log("Login:", data.username);
authApi
.login(data.username, data.password)
.then((r) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ const UsersPage = () => {
icon: <Delete />,
title: "Delete",
onClick: () => {
console.log("delete");
handleDelete();
},
},
Expand All @@ -154,7 +153,6 @@ const UsersPage = () => {
: "Mark as Active",
disabled: selectionState.active === "mixed",
onClick: () => {
console.log("switch active");
selectionState.active === "true"
? handleChangeActive(false)
: handleChangeActive(true);
Expand All @@ -171,7 +169,6 @@ const UsersPage = () => {
selectionState.staff === "true" ? "Remove Staff" : "Make Staff",
disabled: selectionState.staff === "mixed",
onClick: () => {
console.log("switch staff");
selectionState.staff === "true"
? handleChangeRole(false, "Staff")
: handleChangeRole(true, "Staff");
Expand All @@ -190,7 +187,6 @@ const UsersPage = () => {
: "Make SuperUser",
disabled: selectionState.su === "mixed",
onClick: () => {
console.log("switch staff");
selectionState.su === "true"
? handleChangeRole(false, "Superuser")
: handleChangeRole(true, "Superuser");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ const Component = (props: {
};

const onSubmit: SubmitHandler<userType.UserFormFields> = (data) => {
console.log("submit:", data);

if (Object.keys(errors).length === 0)
if (editMode && props.initialUser?.id) {
userApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ const Component = (props: { control: any }) => {
userApi
.getUsers()
.then((response) => {
console.log(response);
setUsers(response.data);
})
.catch((error) => {
console.log(error);
setUsers([]);
});
}, [refetch]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ const Component = (props: {
};

const onSubmit: SubmitHandler<votingType.VotingFormFields> = (data) => {
console.log("submit:", data);
if (Object.keys(errors).length === 0)
if (editMode && props.initialVoting?.id) {
votingApi
Expand Down
10 changes: 0 additions & 10 deletions decide/administration/frontend/src/index.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}
Loading

0 comments on commit 91e3d17

Please sign in to comment.