Compare commits
No commits in common. "20e0d1333bd72692f991323bca13e3297ef34825" and "2eb2884b46e32dc7f5322e60d4653a68813906b2" have entirely different histories.
20e0d1333b
...
2eb2884b46
@ -1,11 +1,10 @@
|
|||||||
FROM docker:dind
|
FROM docker:dind
|
||||||
|
|
||||||
RUN apk add --update python3 && ln -sf python3 /usr/bin/python
|
RUN apk add --update python3 && ln -sf python3 /usr/bin/python
|
||||||
|
RUN python3 -m ensurepip
|
||||||
RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev jpeg-dev zlib-dev libjpeg
|
RUN apk update && apk add postgresql-dev gcc python3-dev musl-dev jpeg-dev zlib-dev libjpeg
|
||||||
RUN apk add py3-pip
|
RUN pip3 install --upgrade pip wheel setuptools
|
||||||
RUN python3 -m venv venv
|
RUN addgroup -S docker
|
||||||
RUN source venv/bin/activate
|
|
||||||
RUN pip install --break-system-packages --upgrade pip wheel setuptools
|
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
ENV DJANGO_SETTINGS_MODULE Sprint.settings
|
ENV DJANGO_SETTINGS_MODULE Sprint.settings
|
||||||
@ -15,7 +14,7 @@ COPY requirements.txt /usr/src/app/requirements.txt
|
|||||||
|
|
||||||
WORKDIR /usr/src/app/
|
WORKDIR /usr/src/app/
|
||||||
|
|
||||||
RUN pip install -r requirements.txt --break-system-packages
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
COPY . /usr/src/app/
|
COPY . /usr/src/app/
|
||||||
|
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
# Generated by Django 3.2.4 on 2022-10-20 17:42
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('Main', '0039_auto_20221013_1855'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.DeleteModel(
|
|
||||||
name='Subscription',
|
|
||||||
),
|
|
||||||
]
|
|
@ -2,6 +2,7 @@ from Main.models.userinfo import UserInfo
|
|||||||
from Main.models.group import Group
|
from Main.models.group import Group
|
||||||
from Main.models.task import Task
|
from Main.models.task import Task
|
||||||
from Main.models.set import Set
|
from Main.models.set import Set
|
||||||
|
from Main.models.subscription import Subscription
|
||||||
from Main.models.settask import SetTask
|
from Main.models.settask import SetTask
|
||||||
from Main.models.solution import Solution
|
from Main.models.solution import Solution
|
||||||
from Main.models.extrafile import ExtraFile
|
from Main.models.extrafile import ExtraFile
|
||||||
|
12
Main/models/subscription.py
Normal file
12
Main/models/subscription.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
from django.db import models
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
from Main.models.group import Group
|
||||||
|
|
||||||
|
|
||||||
|
class Subscription(models.Model):
|
||||||
|
group = models.ForeignKey(
|
||||||
|
Group, on_delete=models.CASCADE, related_name="subscriptions"
|
||||||
|
)
|
||||||
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
|
role = models.IntegerField()
|
@ -36,11 +36,11 @@ class MainView(BaseView):
|
|||||||
all_tasks = Task.objects.filter(solution__user=self.request.user).distinct()
|
all_tasks = Task.objects.filter(solution__user=self.request.user).distinct()
|
||||||
ok_tasks = all_tasks.filter(solution__result="OK").distinct()
|
ok_tasks = all_tasks.filter(solution__result="OK").distinct()
|
||||||
undone_tasks = set(all_tasks) - set(ok_tasks)
|
undone_tasks = set(all_tasks) - set(ok_tasks)
|
||||||
self.context['undone_tasks'] = sample(list(undone_tasks), k=min(5, len(undone_tasks)))
|
self.context['undone_tasks'] = sample(undone_tasks, k=min(5, len(undone_tasks)))
|
||||||
for task in self.context['undone_tasks']:
|
for task in self.context['undone_tasks']:
|
||||||
setattr(task, 'solution', Solution.objects.filter(user=self.request.user, task=task).last())
|
setattr(task, 'solution', Solution.objects.filter(user=self.request.user, task=task).last())
|
||||||
new_tasks = set(Task.objects.filter(public=True)) - set(all_tasks)
|
new_tasks = set(Task.objects.filter(public=True)) - set(all_tasks)
|
||||||
self.context['new_tasks'] = sample(list(new_tasks), k=min(5, len(new_tasks)))
|
self.context['new_tasks'] = sample(new_tasks, k=min(5, len(new_tasks)))
|
||||||
self.context['groups'] = Group.objects.filter(
|
self.context['groups'] = Group.objects.filter(
|
||||||
Q(editors__in=self.request.user.username) | Q(creator=self.request.user) | Q(
|
Q(editors__in=self.request.user.username) | Q(creator=self.request.user) | Q(
|
||||||
users=self.request.user)).distinct()
|
users=self.request.user)).distinct()
|
||||||
|
@ -6,7 +6,6 @@ from django.db import transaction
|
|||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.core.management import BaseCommand
|
from django.core.management import BaseCommand
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django import db
|
|
||||||
from pika.adapters.utils.connection_workflow import AMQPConnectorException
|
from pika.adapters.utils.connection_workflow import AMQPConnectorException
|
||||||
|
|
||||||
from Main.models.outbox_message import OutboxMessage
|
from Main.models.outbox_message import OutboxMessage
|
||||||
@ -38,7 +37,6 @@ class MessagingSupport(BaseCommand):
|
|||||||
print("Message is not JSON decodable")
|
print("Message is not JSON decodable")
|
||||||
return
|
return
|
||||||
print(f"Got {data}, processing...")
|
print(f"Got {data}, processing...")
|
||||||
db.close_old_connections()
|
|
||||||
try:
|
try:
|
||||||
outbox_message = OutboxMessage.objects.get(id=data["id"])
|
outbox_message = OutboxMessage.objects.get(id=data["id"])
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
|
@ -2,7 +2,7 @@ events {}
|
|||||||
|
|
||||||
http {
|
http {
|
||||||
server {
|
server {
|
||||||
listen 1238;
|
listen 1235;
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://web:8000/;
|
proxy_pass http://web:8000/;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
aiofiles==0.7.0
|
aiofiles==0.7.0
|
||||||
aiohttp==3.9.0b0
|
aiohttp==3.8.0
|
||||||
amqp==5.0.6
|
amqp==5.0.6
|
||||||
asgiref==3.3.4
|
asgiref==3.3.4
|
||||||
billiard==3.6.4.0
|
billiard==3.6.4.0
|
||||||
|
Loading…
Reference in New Issue
Block a user