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

Bugfix #139

Merged
merged 4 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
bak.sql
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,23 @@ Para mais detalhes, consulte a [documentação do Cypress](https://docs.cypress.
O notaR está configurado com ferramentas de debug e profiling para ajudar no desenvolvimento. Para
habilitar o Xdebug, abra o arquivo docker/php/php.ini, descomente a linha de xdebug.mode e construa
novamente os containers. O debug pode ser feito na sua IDE (no VSCode, é recomendado instalar a
extensão Xdebug) e os arquivos de profiling serão gerados na pasta storage/logs e podem ser lidos
extensão Xdebug) e os arquivos de profiling serão gerados na pasta storage/logs e podem ser lidos
com o KCacheGrind.

# Backup do banco de dados mysql no Docker

Para fazer o dump do banco de dados, primeiro entre no contêiner passando as variáveis de ambiente do .env:
```
docker exec -ti --env-file=.env notar_mysql_1 bash
```
E em seguida faça o dump usando as variáveis de ambiente:
```
mysqldump -uroot -p${DB_PASSWORD} ${DB_DATABASE} > bak.sql
```
Por fim, copie o arquivo de backup do contêiner para fora do contêiner:
```
docker cp notar_mysql_1:bak.sql .
```

## Licença de uso
O código fonte do notaR está disponível sob licença GPLv3.
5 changes: 3 additions & 2 deletions app/Http/Controllers/RelatorioController.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ public function relatorioNotas (Turma $turma) {
*/
public function relatorioRealizacao (Turma $turma) {

$prazos = $turma->prazos->sortBy('exercicio.name');
$nusers = $turma->users->count();
foreach($turma->prazos as $prazo) {
foreach($prazos as $prazo) {
$arr = collect();
foreach($turma->users as $user) {
$notas = $user->notasValidas($prazo);
Expand Down Expand Up @@ -127,7 +128,7 @@ public function relatorioRealizacao (Turma $turma) {
}

$colnames = ['Exercício','Tentaram','Tiveram nota máxima', 'Média de Tentativas', 'Média de Notas'];
$mytable = $turma->prazos->pluck('resumo');
$mytable = $prazos->pluck('resumo');
$mytable->prepend($colnames);
return $mytable;
}
Expand Down
58 changes: 41 additions & 17 deletions resources/views/turma/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
@include ('includes.error_alert')
<div class="form-group">
<label for="name">Nome</label>
<input type="text" class="form-control @error('name') is-invalid @enderror" id="name" name="name" value="{{ old('nome', $turma->name) }}">
<input type="text"
class="form-control @error('name') is-invalid @enderror"
id="name" name="name"
value="{{ old('nome', $turma->name) }}">
@error('name')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
Expand All @@ -34,7 +37,11 @@

<div class="form-group">
<label for="description">Descrição</label>
<textarea class="form-control @error('description') is-invalid @enderror" id="description" name="description">{{ old('description',$turma->description) }}</textarea>
<textarea
class="form-control @error('description') is-invalid @enderror"
id="description" name="description">
{{ old('description',$turma->description) }}
</textarea>
@error('description')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
Expand All @@ -60,35 +67,52 @@
</form>
</div>

<a class="collapse-button" data-toggle="collapse" href="#collapseMembros" role="button" aria-expanded="true" aria-controls="collapseMembros">
<h2>Membros</h2>
<a class="collapse-button collapsed" data-toggle="collapse"
href="#collapseMembros"
role="button" aria-expanded="false"
aria-controls="collapseMembros">
<h2>
Membros
<i class="fa fa-chevron-right rotate"></i>
</h2>
</a>
<div class="collapse" id="collapseMembros">
@include('user.table',['users' => $turma->users, 'editButton' => true, 'removeButton' => true])
</div>

@if($prazosFuturos ?? '')
<a class="collapse-button" data-toggle="collapse" href="#collapsePrazosFuturos" role="button" aria-expanded="true" aria-controls="collapsePrazosFuturos">
<h2>Prazos Futuros</h2>
</a>
<div class="collapse" id="collapsePrazosFuturos">
@include('prazo.table',['prazos' => $prazosFuturos])
</div>

@endif

@if($prazosPassados ?? '')
<a class="collapse-button" data-toggle="collapse" href="#collapsePrazosPassados" role="button" aria-expanded="true" aria-controls="collapsePrazosPassados">
<h2>Prazos Passados</h2>
<a class="collapse-button collapsed" data-toggle="collapse"
href="#collapsePrazosPassados"
role="button" aria-expanded="false"
aria-controls="collapsePrazosPassados">
<h2>
Prazos Passados
<i class="fa fa-chevron-right rotate"></i>
</h2>
</a>
<div class="collapse" id="collapsePrazosPassados">
@include('prazo.table',['prazos' => $prazosPassados])
</div>
@endif

@if($prazosFuturos ?? '')
<a class="collapse-button collapsed" data-toggle="collapse"
href="#collapsePrazosFuturos"
role="button" aria-expanded="false"
aria-controls="collapsePrazosFuturos">
<h2>
Prazos Futuros
<i class="fa fa-chevron-right rotate"></i>
</h2>
</a>
<div class="collapse" id="collapsePrazosFuturos">
@include('prazo.table',['prazos' => $prazosFuturos])
</div>

@endif

@can ('delete', $turma)
<form method="POST" action="{{URL::to("/turma/".$turma->id)}}">
<form method="POST" action="{{URL::to("/turma/".$turma->id)}}">
{{ csrf_field() }}
{{ method_field('DELETE') }}

Expand Down
47 changes: 33 additions & 14 deletions resources/views/turma/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
<p>{!! nl2br($turma->description) !!}</p>
</div>

@can('seeMembers', $turma)
<a class="collapse-button" data-toggle="collapse" href="#collapseMembros" role="button" aria-expanded="true" aria-controls="collapseMembros">
<h2>Membros</h2>
@can('viewMembers', $turma)
<a class="collapse-button collapsed" data-toggle="collapse"
href="#collapseMembros"
role="button" aria-expanded="false"
aria-controls="collapseMembros">
<h2>
Membros
<i class="fa fa-chevron-right rotate"></i>
</h2>
</a>
<div class="collapse show" id="collapseMembros">
<div class="collapse" id="collapseMembros">
@can ('edit', $turma)
@include('user.table',['users' => $turma->users,
'removeButton' => true])
Expand All @@ -20,21 +26,34 @@
</div>
@endcan

@if($prazosFuturos ?? '')
<a class="collapse-button" data-toggle="collapse" href="#collapsePrazosFuturos" role="button" aria-expanded="true" aria-controls="collapsePrazosFuturos">
<h2>Prazos Futuros</h2>
@if($prazosPassados ?? '')
<a class="collapse-button collapsed" data-toggle="collapse"
href="#collapsePrazosPassados"
role="button" aria-expanded="false"
aria-controls="collapsePrazosPassados">
<h2>
Prazos Passados
<i class="fa fa-chevron-right rotate"></i>
</h2>
</a>
<div class="collapse {{$collapsed ?? "" ? "" : "show" }}" id="collapsePrazosFuturos">
@include('prazo.table',['prazos' => $prazosFuturos])
<div class="collapse" id="collapsePrazosPassados">
@include('prazo.table',['prazos' => $prazosPassados])
</div>
@endif

@if($prazosPassados ?? '')
<a class="collapse-button" data-toggle="collapse" href="#collapsePrazosPassados" role="button" aria-expanded="true" aria-controls="collapsePrazosPassados">
<h2>Prazos Passados</h2>
@if($prazosFuturos ?? '')
<a class="collapse-button" data-toggle="collapse"
href="#collapsePrazosFuturos"
role="button" aria-expanded="true"
aria-controls="collapsePrazosFuturos">
<h2>
Prazos Futuros
<i class="fa fa-chevron-right rotate"></i>
</h2>
</a>
<div class="collapse" id="collapsePrazosPassados">
@include('prazo.table',['prazos' => $prazosPassados])
<div class="collapse show"
id="collapsePrazosFuturos">
@include('prazo.table',['prazos' => $prazosFuturos])
</div>
@endif

Expand Down
44 changes: 32 additions & 12 deletions resources/views/user/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,46 @@
</div>

<div class="container">
@if($prazosFuturos ?? '')
<a class="collapse-button" data-toggle="collapse" href="#collapsePrazosFuturos" role="button" aria-expanded="true" aria-controls="collapsePrazosFuturos">
<h2>Prazos Futuros</h2>

@if($prazosPassados ?? '')
<a class="collapse-button collapsed" data-toggle="collapse"
href="#collapsePrazosPassados"
role="button" aria-expanded="false"
aria-controls="collapsePrazosPassados">
<h2>
Notas Passadas
<i class="fa fa-chevron-right rotate"></i>
</h2>
</a>
<div class="collapse {{$collapsed ?? "" ? "" : "show" }}" id="collapsePrazosFuturos">
@include('prazo.table',['prazos' => $prazosFuturos])
<div class="collapse" id="collapsePrazosPassados">
@include('prazo.table',['prazos' => $prazosPassados])
</div>
@endif

@if($prazosPassados ?? '')
<a class="collapse-button" data-toggle="collapse" href="#collapsePrazosPassados" role="button" aria-expanded="true" aria-controls="collapsePrazosPassados">
<h2>Notas Passadas</h2>
@if($prazosFuturos ?? '')
<a class="collapse-button collapsed" data-toggle="collapse"
href="#collapsePrazosFuturos"
role="button" aria-expanded="false"
aria-controls="collapsePrazosFuturos">
<h2>
Prazos Futuros
<i class="fa fa-chevron-right rotate"></i>
</h2>
</a>
<div class="collapse show" id="collapsePrazosPassados">
@include('prazo.table',['prazos' => $prazosPassados])
<div class="collapse" id="collapsePrazosFuturos">
@include('prazo.table',['prazos' => $prazosFuturos])
</div>

@endif

<a class="collapse-button" data-toggle="collapse" href="#collapseTurmas" role="button" aria-expanded="true" aria-controls="collapseTurmas">
<h2>Turmas</h2>
<a class="collapse-button" data-toggle="collapse"
href="#collapseTurmas"
role="button" aria-expanded="true"
aria-controls="collapseTurmas">
<h2>
Turmas
<i class="fa fa-chevron-right rotate"></i>
</h2>
</a>
<div class="collapse show" id="collapseTurmas">
@include('turma.table',['turmas' => $user->turmas, 'editButton' => false, 'removeButton' => true])
Expand Down