This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
[documentation] Criar documentação da ata 03 #40
Closed
Closed
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
3c32e77
Merge pull request #13 from unb-mds/feature/django-bootstrap
bitterteriyaki 8ad63cf
feat(templates): add the initial project templates
bitterteriyaki bd5909a
feat(templates/base): add the initial navbar
bitterteriyaki a577c09
feat(templates): add initial registering template
LuizaMaluf 5bb1483
style: fix code code style
bitterteriyaki 8725e46
chore(pyproject): change project name
bitterteriyaki 41be42f
feat(apps/users): add the initial users app
bitterteriyaki 566e487
fix: fix `mypy` module conflict
bitterteriyaki 677f34e
Merge pull request #17 from unb-mds/feature/user-model
bitterteriyaki d060337
feat(apps/contests): add the initial contests app
bitterteriyaki 443a5e3
feat(apps/contests): add a status field to the contest model
bitterteriyaki dcea9ca
feat(apps/contests): add the initial views for the contest app
bitterteriyaki dd58307
feat(apps/contests): save the sent code as a string buffer
bitterteriyaki 47e9402
feat(apps/contests): improve the admin page
bitterteriyaki a8facb4
build(deps-dev): bump urllib3 from 2.0.5 to 2.0.6
dependabot[bot] c57512f
Merge pull request #20 from unb-mds/dependabot/pip/urllib3-2.0.6
bitterteriyaki 819783c
Merge branch 'main' into feature/contests
bitterteriyaki a539ed7
Merge pull request #18 from unb-mds/feature/contests
bitterteriyaki f0bef79
docs: add second meeting minutes
thegm445 9860629
Merge pull request #22 from unb-mds/documentation/ata-02
bitterteriyaki ecb4c0e
feat(apps/problems): add the initial problem app
bitterteriyaki 67ac74d
feat(templates/contests): add the contest duration inside the card
bitterteriyaki e297346
feat(templates/contests): improve contests list page
bitterteriyaki cb12cac
feat(templates/contests): show the number of problems in a contest
bitterteriyaki 6b27a6c
feat(templates/contests): improve the contest details page
bitterteriyaki cdd8cb6
fix(templates/contests): pluralize the word `problem` correctly
bitterteriyaki 3ff43e8
Merge pull request #26 from unb-mds/feature/problems
bitterteriyaki b4948cd
docs(sprints): add initial sprints documentation
thegm445 fccd6e8
docs(sprints): fix minor issues
thegm445 ee6079d
docs(installation): add instructions on README
thegm445 42b75d3
docs(installation): add instructions on README
thegm445 dbaf5c4
docs: add third meeting minutes
thegm445 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,27 @@ | ||
# 2023-2-Squad06 | ||
|
||
# Guia de instalação | ||
|
||
## Resumo | ||
|
||
Para a instalação e a operação corretas, deve se ter instalado na máquina: | ||
- Python versão 3.11.5 | ||
- Poetry versão 1.6.1 | ||
|
||
Após verificar quanto aos requisitos acima, rode estes comandos: | ||
|
||
- `poetry install` | ||
- Se necessárias dependências de documentação, `poetry install --with docs` | ||
- Para instalar Git Hooks: | ||
```bash | ||
poetry run pre-commit install \ | ||
--hook-type commit-msg \ | ||
--hook-type pre-commit \ | ||
--hook-type pre-push | ||
``` | ||
- Gerar o arquivo config `poetry run ./bin/create-env` | ||
- Para finalizar a instalação e conseguir visualizar a página: | ||
|
||
- `docker compose build && docker compose up -d` | ||
- `docker compose run django python manage.py migrate` | ||
- `docker compose run django python manage.py createsuperuser` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.apps import AppConfig | ||
|
||
default_app_config = "apps.contests.ContestsConfig" | ||
|
||
|
||
class ContestsConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "apps.contests" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
from django.contrib.admin import ModelAdmin, register | ||
from django.forms import CharField, ModelForm, Textarea | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
from apps.contests.models import Contest | ||
|
||
if TYPE_CHECKING: | ||
ContestAdminBase = ModelAdmin[Contest] | ||
ContestModelFormBase = ModelForm[Contest] | ||
else: | ||
ContestAdminBase = ModelAdmin | ||
ContestModelFormBase = ModelForm | ||
|
||
|
||
class ContestModelForm(ContestModelFormBase): | ||
description = CharField(widget=Textarea(attrs={"rows": 14, "cols": 80})) | ||
|
||
class Meta: | ||
model = Contest | ||
fields = "__all__" | ||
|
||
|
||
@register(Contest) | ||
class ContestAdmin(ContestAdminBase): | ||
form = ContestModelForm | ||
|
||
list_display = ("title", "start_time", "end_time", "status") | ||
list_filter = ("start_time", "end_time") | ||
|
||
fieldsets = [ | ||
(_("General"), {"fields": ("title", "description")}), | ||
(_("Other"), {"fields": ("start_time", "end_time", "cancelled")}), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from enum import StrEnum | ||
|
||
|
||
class ContestStatus(StrEnum): | ||
PENDING = "Pending" | ||
RUNNING = "Running" | ||
FINISHED = "Finished" | ||
CANCELLED = "Cancelled" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Generated by Django 4.2.5 on 2023-09-30 05:03 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Contest", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("created_at", models.DateTimeField(auto_now_add=True)), | ||
("updated_at", models.DateTimeField(auto_now=True)), | ||
("title", models.CharField(max_length=256)), | ||
("description", models.CharField(max_length=1024)), | ||
("start_time", models.DateTimeField()), | ||
("end_time", models.DateTimeField()), | ||
( | ||
"users", | ||
models.ManyToManyField( | ||
related_name="contests", to=settings.AUTH_USER_MODEL | ||
), | ||
), | ||
], | ||
options={ | ||
"db_table": "contests", | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.5 on 2023-09-30 05:21 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("contests", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="contest", | ||
name="cancelled", | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from django.db.models import ( | ||
BooleanField, | ||
CharField, | ||
DateTimeField, | ||
ManyToManyField, | ||
) | ||
from django.utils.timezone import now | ||
|
||
from apps.contests.enums import ContestStatus | ||
from apps.users.models import User | ||
from core.models import TimestampedModel | ||
|
||
|
||
class Contest(TimestampedModel): | ||
"""Represents a contest.""" | ||
|
||
id: int | ||
|
||
title = CharField(max_length=256) | ||
description = CharField(max_length=1024) | ||
|
||
start_time = DateTimeField() | ||
end_time = DateTimeField() | ||
cancelled = BooleanField(default=False) | ||
|
||
users = ManyToManyField(User, related_name="contests") | ||
|
||
class Meta: | ||
db_table = "contests" | ||
|
||
def __str__(self) -> str: | ||
return f"{self.title} #{self.id}" | ||
|
||
@property | ||
def status(self) -> ContestStatus: | ||
if self.cancelled: | ||
return ContestStatus.CANCELLED | ||
|
||
if self.start_time > now(): | ||
return ContestStatus.PENDING | ||
elif self.end_time < now(): | ||
return ContestStatus.FINISHED | ||
else: | ||
return ContestStatus.RUNNING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.urls import path | ||
|
||
from apps.contests.views import DetailView | ||
|
||
app_name = "contests" | ||
|
||
urlpatterns = [ | ||
path("<int:pk>/", DetailView.as_view(), name="detail"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from typing import TYPE_CHECKING, Any | ||
|
||
from django.db.models.query import QuerySet | ||
from django.views import generic | ||
|
||
from apps.contests.enums import ContestStatus | ||
from apps.contests.models import Contest | ||
|
||
if TYPE_CHECKING: | ||
IndexViewBase = generic.ListView[Contest] | ||
DetailViewBase = generic.DetailView[Contest] | ||
else: | ||
IndexViewBase = generic.ListView | ||
DetailViewBase = generic.DetailView | ||
|
||
|
||
class IndexView(IndexViewBase): | ||
template_name = "contests/index.html" | ||
context_object_name = "contests" | ||
|
||
def get_queryset(self) -> QuerySet[Contest]: | ||
return Contest._default_manager.order_by("start_time")[:5] | ||
|
||
def get_context_data(self, **kwargs: Any) -> dict[str, Any]: | ||
ctx = super().get_context_data(**kwargs) | ||
ctx["valid_statuses"] = (ContestStatus.PENDING, ContestStatus.RUNNING) | ||
|
||
return ctx | ||
|
||
|
||
class DetailView(DetailViewBase): | ||
model = Contest | ||
template_name = "contests/detail.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.apps import AppConfig | ||
|
||
default_app_config = "apps.problems.ProblemsConfig" | ||
|
||
|
||
class ProblemsConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "apps.problems" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
from django.contrib.admin import ModelAdmin, register | ||
from django.forms import CharField, IntegerField, ModelForm, Textarea | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
from apps.problems.models import Problem | ||
|
||
if TYPE_CHECKING: | ||
ProblemAdminBase = ModelAdmin[Problem] | ||
ProblemModelFormBase = ModelForm[Problem] | ||
else: | ||
ProblemAdminBase = ModelAdmin | ||
ProblemModelFormBase = ModelForm | ||
|
||
|
||
class ProblemModelForm(ProblemModelFormBase): | ||
description = CharField(widget=Textarea(attrs={"rows": 14, "cols": 80})) | ||
score = IntegerField(min_value=0, required=False) | ||
|
||
memory_limit = IntegerField( | ||
min_value=0, required=False, help_text=_("In bytes.") | ||
) | ||
time_limit = IntegerField( | ||
min_value=0, required=False, help_text=_("In seconds.") | ||
) | ||
|
||
class Meta: | ||
model = Problem | ||
fields = "__all__" | ||
|
||
|
||
@register(Problem) | ||
class ProblemAdmin(ProblemAdminBase): | ||
form = ProblemModelForm | ||
|
||
list_display = ("title", "contest", "memory_limit", "time_limit") | ||
list_filter = ("contest", "score") | ||
|
||
fieldsets = [ | ||
(_("General"), {"fields": ("title", "description")}), | ||
(_("Meta"), {"fields": ("contest", "score")}), | ||
(_("Limits"), {"fields": ("memory_limit", "time_limit")}), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Generated by Django 4.2.5 on 2023-10-03 12:48 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [ | ||
("contests", "0002_contest_cancelled"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Problem", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("created_at", models.DateTimeField(auto_now_add=True)), | ||
("updated_at", models.DateTimeField(auto_now=True)), | ||
("title", models.CharField(max_length=256)), | ||
("description", models.CharField(max_length=4096)), | ||
( | ||
"contest", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="problems", | ||
to="contests.contest", | ||
), | ||
), | ||
], | ||
options={ | ||
"ordering": ["-created_at", "-updated_at"], | ||
"abstract": False, | ||
}, | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
apps/problems/migrations/0002_alter_problem_options_alter_problem_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 4.2.5 on 2023-10-03 17:07 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("problems", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name="problem", | ||
options={}, | ||
), | ||
migrations.AlterModelTable( | ||
name="problem", | ||
table="problems", | ||
), | ||
] |
27 changes: 27 additions & 0 deletions
27
apps/problems/migrations/0003_problem_memory_limit_problem_score_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 4.2.5 on 2023-10-04 22:05 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("problems", "0002_alter_problem_options_alter_problem_table"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="problem", | ||
name="memory_limit", | ||
field=models.IntegerField(null=True), | ||
), | ||
migrations.AddField( | ||
model_name="problem", | ||
name="score", | ||
field=models.IntegerField(null=True), | ||
), | ||
migrations.AddField( | ||
model_name="problem", | ||
name="time_limit", | ||
field=models.IntegerField(null=True), | ||
), | ||
] |
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Este código pertence a outro pull request.