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

Groups implemented #25

Merged
merged 10 commits into from
Mar 4, 2024
Merged

Groups implemented #25

merged 10 commits into from
Mar 4, 2024

Conversation

ReinhardDP
Copy link
Contributor

Groups in now implemented in the models and I added some fields.
I am not sure if the migrations work.

Copy link
Contributor

@PJDeSmijter PJDeSmijter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, submission.group_id should indeed be not nullable but this works for now

@RunoBoy
Copy link
Contributor

RunoBoy commented Mar 2, 2024

Group_id was nullable so that a submission could be part of a student OR of a group, so one of the fields needed to be null. But in this version indeed, it can't be NULL. Migrating when removing the NULL constraction gives some problems considering the row now has missing values. But considering that we are working with an empty database we could use the trick of removing the auto-generated files in migrations (except __init__.py) and than re-running
python manage.py makemigrations
python manage.py migrate
should give us the final model implementation

-> the objects property makes it easy to get:
- all values in table
- filter values
- count values
...

- final_score field has been moved from group to project

- Conditions model has been made to save requested conditions for a project, including 2 models for forbidden/allowed extension

- Migrations have been reset to handle new models and constraints
@PJDeSmijter PJDeSmijter self-requested a review March 3, 2024 10:29
Copy link
Contributor

@PJDeSmijter PJDeSmijter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get this error when executing migrate/makemigrations:

`System check identified some issues:

WARNINGS:
users.Student.id: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
users.Teacher.id: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0002_alter_submissions_file, 0002_alter_submissions_file_alter_submissions_output_test in submissions).
To fix them run 'python manage.py makemigrations --merge'`

@robinpdev
Copy link
Contributor

I get this error when executing migrate/makemigrations:

`System check identified some issues:

WARNINGS: users.Student.id: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField. HINT: ForeignKey(unique=True) is usually better served by a OneToOneField. users.Teacher.id: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField. HINT: ForeignKey(unique=True) is usually better served by a OneToOneField. CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0002_alter_submissions_file, 0002_alter_submissions_file_alter_submissions_output_test in submissions). To fix them run 'python manage.py makemigrations --merge'`

what happens when you run python manage.py makemigrations --merge
Of course, run this inside the backend docker container by doing docker exec -it pigeonhole-backend sh first

@PJDeSmijter
Copy link
Contributor

I get this error when executing migrate/makemigrations:
System check identified some issues: WARNINGS: users.Student.id: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField. HINT: ForeignKey(unique=True) is usually better served by a OneToOneField. users.Teacher.id: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField. HINT: ForeignKey(unique=True) is usually better served by a OneToOneField. CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0002_alter_submissions_file, 0002_alter_submissions_file_alter_submissions_output_test in submissions). To fix them run 'python manage.py makemigrations --merge'

what happens when you run python manage.py makemigrations --merge Of course, run this inside the backend docker container by doing docker exec -it pigeonhole-backend sh first

It made some new migration files, looks like it works.

@PJDeSmijter PJDeSmijter self-requested a review March 3, 2024 12:17
Copy link
Contributor

@RunoBoy RunoBoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be finished

@axellorreyne axellorreyne merged commit 8e79ef7 into develop Mar 4, 2024
2 checks passed
@axellorreyne axellorreyne deleted the models-implementation branch March 4, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants