Skip to content

Commit 083e8c3

Browse files
authored
Merge pull request #394 from PROCOLLAB-github/fix/ooutload
fix outload
2 parents 9602b22 + 1078b01 commit 083e8c3

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

users/admin.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,13 @@ def force_verify(self, request, object_id):
212212

213213
def get_export_users_emails(self, users):
214214
response_data = tablib.Dataset(
215-
headers=["Имя и фамилия", "Возраст", "Интересы", "ВУЗ", "Специальность"]
215+
headers=[
216+
"Имя и фамилия",
217+
"Возраст",
218+
"Интересы",
219+
"ВУЗ / Школа",
220+
"Специальность",
221+
]
216222
)
217223

218224
today = date.today()
@@ -222,7 +228,9 @@ def get_export_users_emails(self, users):
222228
CustomUser.objects.all()
223229
.select_related("v2_speciality")
224230
.prefetch_related(
225-
"collaborations__project", "collaborations__project__industry"
231+
"collaborations__project",
232+
"collaborations__project__industry",
233+
"skills__skill",
226234
)
227235
)
228236
little_mans = users.filter(birthday__lte=date_limit_18)
@@ -233,32 +241,41 @@ def get_export_users_emails(self, users):
233241
# quantity_big_mans = whole_quality - quantity_little_mans
234242

235243
for baby in little_mans:
236-
projects_names = [
244+
interests = [
237245
collab.project.industry.name if collab.project.industry else ""
238246
for collab in baby.collaborations.all()
239247
]
248+
if not len(interests):
249+
interests = [
250+
skill_to_obj.skill.name if skill_to_obj.skill else ""
251+
for skill_to_obj in baby.skills.all()
252+
]
253+
if not len(interests):
254+
interests = baby.key_skills.split(",") if baby.key_skills else []
240255
response_data.append(
241256
[
242257
baby.first_name + " " + baby.last_name,
243258
today.year - baby.birthday.year,
244-
", ".join(projects_names),
259+
", ".join(interests),
245260
"",
246261
"",
247262
]
248263
)
249264

250265
for big_man in big_mans:
251-
projects_names = [
266+
industry_names = [
252267
collab.project.industry.name if collab.project.industry else ""
253268
for collab in big_man.collaborations.all()
254269
]
255270
response_data.append(
256271
[
257272
big_man.first_name + " " + big_man.last_name,
258273
today.year - big_man.birthday.year,
259-
", ".join(projects_names),
274+
", ".join(industry_names),
260275
big_man.organization,
261-
big_man.speciality,
276+
big_man.v2_speciality
277+
if big_man.v2_speciality
278+
else big_man.speciality,
262279
]
263280
)
264281

0 commit comments

Comments
 (0)