Skip to content

Commit

Permalink
Merge branch 'main' into topicos
Browse files Browse the repository at this point in the history
  • Loading branch information
Lobz committed Jun 20, 2024
2 parents da37e6d + 14796c1 commit efc0cdb
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 56 deletions.
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceRoot}",
}
}
]
}
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,13 @@ npx cypress run

Para mais detalhes, consulte a [documentação do Cypress](https://docs.cypress.io/).

# Debug e profile

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
com o KCacheGrind.

## Licença de uso
O código fonte do notaR está disponível sob licença GPLv3.
8 changes: 4 additions & 4 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function store(Request $request)
/**
* Show the profile of a given User.
*
* @param App\Models\User $user
* @param User $user
* @return \Illuminate\View\View
*/
public function show(User $user)
Expand All @@ -83,7 +83,7 @@ public function show(User $user)
/**
* Show the form for editing the specified resource.
*
* @param App\Models\User $user
* @param User $user
* @return \Illuminate\Http\Response
*/
public function edit(User $user)
Expand All @@ -99,7 +99,7 @@ public function edit(User $user)
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param App\Models\User $user
* @param User $user
* @return \Illuminate\Http\Response
*/
public function update(Request $request, User $user)
Expand Down Expand Up @@ -132,7 +132,7 @@ public function update(Request $request, User $user)
/**
* Remove the specified resource from storage.
*
* @param App\Models\User $user
* @param User $user
* @return \Illuminate\Http\Response
*/
public function destroy(User $user)
Expand Down
6 changes: 3 additions & 3 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function isAdmin() {
/**
* Nota final (atual) dentro do prazo (get from DB)
*
* @var App\Model\Prazo $prazo
* @var Prazo $prazo
* @return float
*/
public function getNotaFinal(Prazo $prazo) {
Expand All @@ -80,7 +80,7 @@ public function getNotaFinal(Prazo $prazo) {
/**
* Nota final (atual) dentro do prazo
*
* @var App\Model\Prazo $prazo
* @var Prazo $prazo
* @return float
*/
public function notaFinal(Prazo $prazo) {
Expand All @@ -90,7 +90,7 @@ public function notaFinal(Prazo $prazo) {
/**
* Notas dentro do prazo
*
* @var App\Model\Prazo $prazo
* @var Prazo $prazo
*/
public function notasValidas(Prazo $prazo) {
return $this->notas
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# For more information: https://laravel.com/docs/sail
version: '3'
services:
app:
build:
Expand Down
9 changes: 7 additions & 2 deletions docker-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ php artisan migrate --force
php artisan route:clear
php artisan config:clear
php artisan cache:clear
php artisan view:cache
php artisan event:cache
php artisan view:clear
php artisan event:clear
# Cache views and events only on production
if [ "$APP_ENV" == "production" ]; then
php artisan view:cache
php artisan event:cache
fi
7 changes: 7 additions & 0 deletions docker/php/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
pcov.directory = .
xdebug.discover_client_host = true
xdebug.log = /var/www/html/storage/logs/xdebug.log
xdebug.start_with_request = true
xdebug.mode = off
xdebug.output_dir=/var/www/html/storage/logs/
# Uncomment following line and rebuild containers to enable debug and profiling
# xdebug.mode = debug,profile
2 changes: 1 addition & 1 deletion resources/views/exercicio/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class="alert alert-info">{{ Session::get('message') }}</div>
@endif
<!-- content -->
@include('exercicio.table')
@include('exercicio.table', ['editButton' => true])
</div>

</div>
Expand Down
8 changes: 7 additions & 1 deletion resources/views/exercicio/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<thead>
<tr>
<td>Título</td>
<td>Ações</td>
@if ($editButton ?? '')
<td>Ações</td>
@endif
</tr>
</thead>
<tbody>
Expand All @@ -16,14 +18,18 @@
</a>
</td>

@if ($editButton ?? '')
<td>

<!-- edit -->
@if ($editButton ?? '')
@can ('edit', $value)
<a class="btn btn-small btn-edit" href="{{ URL::to('exercicio/' . $value->id . '/edit') }}">Editar</a>
@endcan
@endif

</td>
@endif
</tr>
@endforeach
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/home.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</p>

<p> Caso contrário, você pode fazer os exercícios que se encontram no link ao lado, sem a necessídade de cadastro.
O meterial completo do curso de introdução à linguagem, <a href= "http://ecor.ib.usp.br"> ecoR </a> da USP,
O material completo do curso de introdução à linguagem, <a href= "http://ecor.ib.usp.br"> ecoR </a> da USP,
que motivou o desenvolvimento desta plataforma está disponível para acesso sem custos.

</p>
Expand Down
36 changes: 9 additions & 27 deletions resources/views/prazo/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@
@unless ($exercicio ?? "")
<td>Exercicio</td>
@endif

@unless ($turma ?? "")
<td>Turma</td>
@endif
<td>Prazo</td>

<td>Prazo</td>

@if ($user ?? "")
<td>Nota</td>
@endif
@if ($turma ?? "")
@can ('edit', $turma)
<td>Ações</td>
@endcan
@endif
</tr>
</thead>
<tbody>
Expand All @@ -40,34 +38,18 @@
</a>
</td>
@endif
<td>{{ $value->prazo }}</td>
@if ($user ?? "")

<td>
{{ $user->notaFinal($value) }}
{{ $value->prazo }}
</td>
@endif

@if ($turma ?? "")
@can ('edit', $turma)
@if ($user ?? "")
<td>

<!-- remove -->
@if ($removeButton ?? '')
<form method="POST" action="{{URL::to("/prazo/".$value->id)}}">
{{ csrf_field() }}
{{ method_field('DELETE') }}

<div class="form-group">
<input type="submit" class="btn btn-remove" value="Remover">
</div>
</form>
@endif

{{ $user->notaFinal($value) }}
</td>
@endcan
@endif

</tr>
@endforeach
</tbody>
</table>

7 changes: 6 additions & 1 deletion resources/views/turma/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
<h2>Membros</h2>
</a>
<div class="collapse show" id="collapseMembros">
@include('user.table',['users' => $turma->users, 'editButton' => true, 'removeButton' => true])
@can ('edit', $turma)
@include('user.table',['users' => $turma->users,
'removeButton' => true])
@else
@include('user.table',['users' => $turma->users])
@endcan
</div>

@if($prazosFuturos ?? '')
Expand Down
2 changes: 1 addition & 1 deletion resources/views/user/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
<div class="alert alert-info">{{ Session::get('message') }}</div>
@endif

@include('user.table',['editButton'=>true])
@include('user.table')
</div>
@endsection
10 changes: 0 additions & 10 deletions resources/views/user/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,5 @@
<div class="collapse show" id="collapseTurmas">
@include('turma.table',['turmas' => $user->turmas, 'editButton' => false, 'removeButton' => true])
</div>

<a class="collapse-button" data-toggle="collapse" href="#collapseNotas" role="button" aria-expanded="true" aria-controls="collapseNotas">
<h4>Todas as Notas</h4>
</a>
<div class="collapse" id="collapseNotas">
<div class="alert alert-info">
Esta tabela contém todas as notas já registradas para esse usuário. Note que para uma nota ser válida ela precisa ter data anterior ao prazo correspondente. Apenas a máxima nota válida é usada.
</div>
@include('nota.table',['notas' => $user->notas])
</div>
</div>
@endsection
9 changes: 5 additions & 4 deletions resources/views/user/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
<td>Turmas</td>
@endunless
<td>Admin</td>
<td>Ações</td>
@if ($editButton ?? '' or $removeButton ?? '')
<td>Ações</td>
@endif
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -44,6 +46,7 @@
</a>
</td>

@if ($editButton ?? '' or $removeButton ?? '')
<td>

<!-- edit -->
Expand All @@ -55,14 +58,12 @@

<!-- remove -->
@if ($removeButton ?? '')
@can ('edit', $turma)
<a class="btn btn-small btn-remove" href="{{ URL::to('turma/' . $turma->id . '/remove/'.$value->id) }}">Remover</a>
@endcan
@endif

</td>
@endif
</tr>
@endforeach
</tbody>
</table>

0 comments on commit efc0cdb

Please sign in to comment.