Skip to content

Commit 90f022b

Browse files
authored
Merge pull request #511 from PROCOLLAB-github/dev-update
Dev update
2 parents 36ce91c + 8999c46 commit 90f022b

5 files changed

Lines changed: 127 additions & 53 deletions

File tree

.github/workflows/django-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
python-version: 3.11
2020

2121
- name: cache poetry install
22-
uses: actions/cache@v3
22+
uses: actions/cache@v2
2323
with:
2424
path: ~/.local
2525
key: poetry-1.2.2-0
@@ -32,7 +32,7 @@ jobs:
3232

3333
- name: cache deps
3434
id: cache-deps
35-
uses: actions/cache@v3
35+
uses: actions/cache@v2
3636
with:
3737
path: .venv
3838
key: pydeps-${{ hashFiles('**/poetry.lock') }}

.github/workflows/new_deploy.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: 'new deploy prod server'
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: run on server
11+
uses: garygrossgarten/github-action-ssh@release
12+
with:
13+
host: ${{ secrets.SERVER_HOST }}
14+
username: ${{ secrets.SERVER_USER }}
15+
password: ${{ secrets.SERVER_PASSWORD }}
16+
command: |
17+
cd /home/app/new_procollab_deploy &&
18+
git pull origin master &&
19+
20+
rm -f .env &&
21+
touch .env &&
22+
23+
echo "DJANGO_SECRET_KEY=${{ secrets.DJANGO_SECRET_KEY }}" >> .env &&
24+
25+
echo "DATABASE_NAME=${{ secrets.DATABASE_NAME }}" >> .env &&
26+
echo "DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }}" >> .env &&
27+
echo "DATABASE_USER=${{ secrets.DATABASE_USER }}" >> .env &&
28+
echo "DATABASE_HOST=${{ secrets.DATABASE_HOST }}" >> .env &&
29+
echo "DATABASE_PORT=${{ secrets.DATABASE_PORT }}" >> .env &&
30+
31+
echo "EMAIL_USER=${{ secrets.EMAIL_USER }}" >> .env &&
32+
echo "EMAIL_PASSWORD=${{ secrets.EMAIL_PASSWORD }}" >> .env &&
33+
echo "EMAIL_HOST=${{ secrets.EMAIL_HOST }}" >> .env &&
34+
echo "EMAIL_PORT=${{ secrets.EMAIL_PORT }}" >> .env &&
35+
echo "SELECTEL_ACCOUNT_ID=${{ secrets.SELECTEL_ACCOUNT_ID }}" >> .env &&
36+
echo "SELECTEL_CONTAINER_NAME=${{ secrets.SELECTEL_CONTAINER_NAME }}" >> .env &&
37+
echo "SELECTEL_CONTAINER_PASSWORD=${{ secrets.SELECTEL_CONTAINER_PASSWORD }}" >> .env &&
38+
echo "SELECTEL_CONTAINER_USERNAME=${{ secrets.SELECTEL_CONTAINER_USERNAME }}" >> .env &&
39+
40+
echo "CLICKUP_API_TOKEN=${{ secrets.CLICKUP_API_TOKEN }}" >> .env &&
41+
echo "CLICKUP_SPACE_ID=${{ secrets.CLICKUP_SPACE_ID }}" >> .env &&
42+
43+
echo "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" >> .env &&
44+
45+
echo "UNISENDER_GO_API_KEY=${{ secrets.UNISENDER_GO_API_KEY }}" >> .env &&
46+
47+
docker compose -f docker-compose.prod-ci.yml -p prod up -d --build

.github/workflows/release-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
python-version: 3.11
1919

2020
- name: cache poetry install
21-
uses: actions/cache@v3
21+
uses: actions/cache@v2
2222
with:
2323
path: ~/.local
2424
key: poetry-1.2.2-0
@@ -31,7 +31,7 @@ jobs:
3131

3232
- name: cache deps
3333
id: cache-deps
34-
uses: actions/cache@v3
34+
uses: actions/cache@v2
3535
with:
3636
path: .venv
3737
key: pydeps-${{ hashFiles('**/poetry.lock') }}

docker-compose.prod-ci.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,31 @@ version: '3.9'
22

33
services:
44
web:
5+
build:
6+
context: .
7+
dockerfile: ./Dockerfile
58
image: ghcr.io/procollab-github/api:latest
69
restart: unless-stopped
710
volumes:
8-
- log:/procollab/log
11+
- ./log:/procollab/log
912
env_file:
1013
- .env
1114
environment:
1215
HOST: 0.0.0.0
1316
expose:
1417
- 8000
18+
19+
# web:
20+
# image: ghcr.io/procollab-github/api:latest
21+
# restart: unless-stopped
22+
# volumes:
23+
# - log:/procollab/log
24+
# env_file:
25+
# - .env
26+
# environment:
27+
# HOST: 0.0.0.0
28+
# expose:
29+
# - 8000
1530
grafana:
1631
image: grafana/grafana:latest
1732
restart: unless-stopped

users/admin.py

Lines changed: 60 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,7 @@ def get_export_users_emails(self, users):
280280
headers=[
281281
"Имя и фамилия",
282282
"Возраст",
283-
"Интересы",
284-
"ВУЗ / Школа",
283+
"Город",
285284
"Специальность",
286285
"Эл. почта",
287286
]
@@ -290,67 +289,80 @@ def get_export_users_emails(self, users):
290289
today = date.today()
291290

292291
date_limit_18 = date(today.year - 18, today.month, today.day)
292+
date_limit_22 = date(today.year - 22, today.month, today.day)
293+
# user_ed = UserEducation.objects.select_related(
294+
# "user", "user__v2_speciality"
295+
# ).filter(education_status="Студент")
293296
users = (
294297
CustomUser.objects.all()
295298
.select_related("v2_speciality")
296-
.prefetch_related(
297-
"collaborations__project",
298-
"collaborations__project__industry",
299-
"skills__skill",
300-
"education",
299+
.filter(
300+
birthday__lte=date_limit_18,
301+
birthday__gte=date_limit_22
301302
)
302303
)
303-
little_mans = users.filter(birthday__lte=date_limit_18)
304-
big_mans = users.exclude(id__in=little_mans.values_list("id", flat=True))
304+
# little_mans = users.filter(birthday__lte=date_limit_18)
305+
# big_mans = users.exclude(id__in=little_mans.values_list("id", flat=True))
305306

306307
# whole_quality = users.count()
307308
# quantity_little_mans = little_mans.count()
308309
# quantity_big_mans = whole_quality - quantity_little_mans
309310

310-
for baby in little_mans:
311-
interests = [
312-
collab.project.industry.name if collab.project.industry else ""
313-
for collab in baby.collaborations.all()
314-
]
315-
if not len(interests):
316-
interests = [
317-
skill_to_obj.skill.name if skill_to_obj.skill else ""
318-
for skill_to_obj in baby.skills.all()
319-
]
320-
if not len(interests):
321-
interests = baby.key_skills.split(",") if baby.key_skills else []
311+
for user in users:
322312
response_data.append(
323313
[
324-
baby.first_name + " " + baby.last_name,
325-
today.year - baby.birthday.year,
326-
", ".join(interests),
327-
"; ".join(
328-
baby.education.values_list("organization_name", flat=True)
329-
),
330-
baby.v2_speciality if baby.v2_speciality else baby.speciality,
331-
baby.email,
314+
user.first_name + " " + user.last_name,
315+
(today.year - user.birthday.year)
316+
if user.birthday.year
317+
else None,
318+
user.city,
319+
user.v2_speciality
320+
if user.v2_speciality
321+
else user.speciality,
322+
user.email,
332323
]
333324
)
334325

335-
for big_man in big_mans:
336-
industry_names = [
337-
collab.project.industry.name if collab.project.industry else ""
338-
for collab in big_man.collaborations.all()
339-
]
340-
response_data.append(
341-
[
342-
big_man.first_name + " " + big_man.last_name,
343-
today.year - big_man.birthday.year,
344-
", ".join(industry_names),
345-
"; ".join(
346-
big_man.education.values_list("organization_name", flat=True)
347-
),
348-
big_man.v2_speciality
349-
if big_man.v2_speciality
350-
else big_man.speciality,
351-
big_man.email,
352-
]
353-
)
326+
# for baby in little_mans:
327+
# interests = [
328+
# collab.project.industry.name if collab.project.industry else ""
329+
# for collab in baby.collaborations.all()
330+
# ]
331+
# if not len(interests):
332+
# interests = [
333+
# skill_to_obj.skill.name if skill_to_obj.skill else ""
334+
# for skill_to_obj in baby.skills.all()
335+
# ]
336+
# if not len(interests):
337+
# interests = baby.key_skills.split(",") if baby.key_skills else []
338+
# response_data.append(
339+
# [
340+
# baby.first_name + " " + baby.last_name,
341+
# today.year - baby.birthday.year,
342+
# ", ".join(interests),
343+
# "; ".join(baby.education.values_list("organization_name", flat=True)),
344+
# baby.v2_speciality if baby.v2_speciality else baby.speciality,
345+
# baby.email,
346+
# ]
347+
# )
348+
#
349+
# for big_man in big_mans:
350+
# industry_names = [
351+
# collab.project.industry.name if collab.project.industry else ""
352+
# for collab in big_man.collaborations.all()
353+
# ]
354+
# response_data.append(
355+
# [
356+
# big_man.first_name + " " + big_man.last_name,
357+
# today.year - big_man.birthday.year,
358+
# ", ".join(industry_names),
359+
# "; ".join(big_man.education.values_list("organization_name", flat=True)),
360+
# big_man.v2_speciality
361+
# if big_man.v2_speciality
362+
# else big_man.speciality,
363+
# big_man.email,
364+
# ]
365+
# )
354366

355367
# для малолеток указать теги проектов, если нет - навыки
356368
# для старших - специальность, вуз, учебное заведение

0 commit comments

Comments
 (0)