From bb6b189f804bb6e4b52cc6f7b00d93a8bbf8a784 Mon Sep 17 00:00:00 2001 From: Elizabeth Frolova Date: Mon, 8 Nov 2021 11:30:45 +0000 Subject: [PATCH 1/9] Update templates/sets.html --- templates/sets.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/sets.html b/templates/sets.html index e0e115b..9952eb6 100644 --- a/templates/sets.html +++ b/templates/sets.html @@ -1,5 +1,7 @@ {% extends 'base_main.html' %} +{% block title %}сеты{% endblock %} + {% block main %} @@ -44,4 +46,4 @@ {% for set in user.userinfo.available_sets %} {{ set.name }} {% if set.creator == user %} {% endif %}
{% endfor %} -{% endblock %} \ No newline at end of file +{% endblock %} From 8a7c88cfd8d761d0d106bab99356e3affb4273b3 Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 9 Nov 2021 00:52:09 +0300 Subject: [PATCH 2/9] =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D0=BE=20=D1=81=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D0=B0=D0=BD=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Main/models/userinfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Main/models/userinfo.py b/Main/models/userinfo.py index ffdfdec..0bf7cda 100644 --- a/Main/models/userinfo.py +++ b/Main/models/userinfo.py @@ -21,7 +21,7 @@ class UserInfo(models.Model): notification_solution_result = models.BooleanField(default=False) def _append_task(self, task, tasks): - if task.creator == self.user or task.public: + if task.creator == self.user or task.public or self.user.is_superuser: tasks.append(task) return for st in SetTask.objects.filter(task=task): From cfc3aeae43bf70ef9717fbaa5fd01856ec22f0db Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Fri, 12 Nov 2021 01:30:39 +0300 Subject: [PATCH 3/9] progress --- Main/models/progress.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Main/models/progress.py b/Main/models/progress.py index ca8db42..6092065 100644 --- a/Main/models/progress.py +++ b/Main/models/progress.py @@ -19,7 +19,12 @@ class Progress(models.Model): def time(self): if not self.finished: self.finished_time = timezone.now() - return self.finished_time - self.start_time + seconds = (self.finished_time - self.start_time).total_seconds() + hours = seconds // 3600 + seconds -= hours * 3600 + minutes = seconds // 60 + seconds -= minutes * 60 + return f"{hours}:{minutes}:{seconds}" def increment_rating(self): if self.task.creator == self.user: From 8d3399c598508ad68620887edea75e380ac2251b Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Fri, 12 Nov 2021 01:36:25 +0300 Subject: [PATCH 4/9] path --- Main/models/progress.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Main/models/progress.py b/Main/models/progress.py index 6092065..ff3ad8b 100644 --- a/Main/models/progress.py +++ b/Main/models/progress.py @@ -19,7 +19,7 @@ class Progress(models.Model): def time(self): if not self.finished: self.finished_time = timezone.now() - seconds = (self.finished_time - self.start_time).total_seconds() + seconds = int((self.finished_time - self.start_time).total_seconds()) hours = seconds // 3600 seconds -= hours * 3600 minutes = seconds // 60 From 7b5ee5531c7215b98d1e2cf7b5590601e516f663 Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Fri, 12 Nov 2021 01:46:58 +0300 Subject: [PATCH 5/9] path --- Main/models/progress.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Main/models/progress.py b/Main/models/progress.py index ff3ad8b..ca8db42 100644 --- a/Main/models/progress.py +++ b/Main/models/progress.py @@ -19,12 +19,7 @@ class Progress(models.Model): def time(self): if not self.finished: self.finished_time = timezone.now() - seconds = int((self.finished_time - self.start_time).total_seconds()) - hours = seconds // 3600 - seconds -= hours * 3600 - minutes = seconds // 60 - seconds -= minutes * 60 - return f"{hours}:{minutes}:{seconds}" + return self.finished_time - self.start_time def increment_rating(self): if self.task.creator == self.user: From cc39dae1fbeec036401d740d8b20efb8fc641815 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 12 Nov 2021 19:34:49 +0300 Subject: [PATCH 6/9] button --- templates/account.html | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/account.html b/templates/account.html index bd65305..e65ed8b 100644 --- a/templates/account.html +++ b/templates/account.html @@ -24,6 +24,7 @@

{{ account.userinfo.surname }} {{ account.userinfo.name }} {{ account.userinfo.middle_name }} {{ account.userinfo.activity_status }} + Админ

From 8a155ad731cdf942333102131578f4368c1a4f15 Mon Sep 17 00:00:00 2001 From: Denis Date: Fri, 12 Nov 2021 21:37:26 +0300 Subject: [PATCH 7/9] update_button --- templates/account.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/account.html b/templates/account.html index e65ed8b..3e7585e 100644 --- a/templates/account.html +++ b/templates/account.html @@ -24,7 +24,9 @@

{{ account.userinfo.surname }} {{ account.userinfo.name }} {{ account.userinfo.middle_name }} {{ account.userinfo.activity_status }} - Админ + {% if user.is_superuser %} + Админ + {% endif %}

From b5cdfd362e03ed227cf190570e53c1725245f12e Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Sat, 13 Nov 2021 17:02:00 +0300 Subject: [PATCH 8/9] host --- .gitlab-ci.yml | 5 +---- Sprint/settings.py | 7 +++++-- docker-compose.yaml | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f990870..2becd12 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,8 +5,6 @@ stages: variables: SOLUTIONS_ROOT_EXTERNAL: "/sprint-data/data/solutions" - DB_HOST: "postgres" - RABBIT_HOST: "rabbitmq" build: stage: build @@ -36,8 +34,7 @@ deploy-dev: variables: PORT: 80 SOLUTIONS_ROOT_EXTERNAL: "/sprint-data/data/solutions" - DB_HOST: "postgres" - RABBIT_HOST: "rabbitmq" + HOST: "http://dev.sprinthub.ru/" deploy-prod: extends: diff --git a/Sprint/settings.py b/Sprint/settings.py index 4ea8baa..217c26e 100644 --- a/Sprint/settings.py +++ b/Sprint/settings.py @@ -16,6 +16,9 @@ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +HOST = os.getenv("HOST", "0.0.0.0") + # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ @@ -83,7 +86,7 @@ DATABASES = { "NAME": "sprint", "USER": "postgres", "PASSWORD": os.getenv("DB_PASSWORD", "password"), - "HOST": os.getenv("DB_HOST", "0.0.0.0"), + "HOST": HOST, "PORT": 5432, } } @@ -140,7 +143,7 @@ for root in DATA_ROOT, EXTRA_FILES_ROOT, MEDIA_ROOT: SOLUTIONS_ROOT = os.path.join(DATA_ROOT, "solutions") -RABBIT_HOST = os.getenv("RABBIT_HOST", "0.0.0.0") +RABBIT_HOST = HOST RABBIT_PORT = 5672 STATICFILES_DIRS = [ diff --git a/docker-compose.yaml b/docker-compose.yaml index 0eaa7eb..9a99246 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -22,8 +22,7 @@ services: restart: always environment: PORT: $PORT - DB_HOST: $DB_HOST - RABBIT_HOST: $RABBIT_HOST + HOST: $HOST command: scripts/runserver.sh ports: - "${PORT}:${PORT}" @@ -37,6 +36,8 @@ services: bot: image: mathwave/sprint-repo:sprint restart: always + environment: + HOST: $HOST command: python manage.py bot depends_on: - web @@ -57,8 +58,7 @@ services: command: scripts/create_worker.sh environment: SOLUTIONS_ROOT_EXTERNAL: "${SOLUTIONS_ROOT_EXTERNAL}" - DB_HOST: "${DB_HOST}" - RABBIT_HOST: "${RABBIT_HOST}" + HOST: $HOST depends_on: - web - rabbitmq From a512261c4d4b443cf25874181acd50485f1b40a4 Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Sat, 13 Nov 2021 17:09:46 +0300 Subject: [PATCH 9/9] host --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2becd12..f15570a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,7 +34,7 @@ deploy-dev: variables: PORT: 80 SOLUTIONS_ROOT_EXTERNAL: "/sprint-data/data/solutions" - HOST: "http://dev.sprinthub.ru/" + HOST: "77.246.159.65" deploy-prod: extends: