@@ -253,73 +253,84 @@ def get_export_users_emails(self, users):
253253 headers = [
254254 "Имя и фамилия" ,
255255 "Возраст" ,
256- "Интересы" ,
257- "ВУЗ / Школа" ,
256+ "ВУЗ" ,
258257 "Специальность" ,
259258 "Эл. почта" ,
260259 ]
261260 )
262261
263262 today = date .today ()
264263
265- date_limit_18 = date (today .year - 18 , today .month , today .day )
266- users = (
267- CustomUser .objects .all ()
268- .select_related ("v2_speciality" )
269- .prefetch_related (
270- "collaborations__project" ,
271- "collaborations__project__industry" ,
272- "skills__skill" ,
273- "education" ,
274- )
275- )
276- little_mans = users .filter (birthday__lte = date_limit_18 )
277- big_mans = users .exclude (id__in = little_mans .values_list ("id" , flat = True ))
264+ # date_limit_18 = date(today.year - 18, today.month, today.day)
265+ user_ed = UserEducation .objects .select_related (
266+ "user" , "user__v2_speciality"
267+ ).filter (education_status = "Студент" )
268+ # users = (
269+ # CustomUser.objects.all()
270+ # .select_related("v2_speciality")
271+ # )
272+ # little_mans = users.filter(birthday__lte=date_limit_18)
273+ # big_mans = users.exclude(id__in=little_mans.values_list("id", flat=True))
278274
279275 # whole_quality = users.count()
280276 # quantity_little_mans = little_mans.count()
281277 # quantity_big_mans = whole_quality - quantity_little_mans
282278
283- for baby in little_mans :
284- interests = [
285- collab .project .industry .name if collab .project .industry else ""
286- for collab in baby .collaborations .all ()
287- ]
288- if not len (interests ):
289- interests = [
290- skill_to_obj .skill .name if skill_to_obj .skill else ""
291- for skill_to_obj in baby .skills .all ()
292- ]
293- if not len (interests ):
294- interests = baby .key_skills .split ("," ) if baby .key_skills else []
279+ for ed in user_ed :
295280 response_data .append (
296281 [
297- baby .first_name + " " + baby .last_name ,
298- today .year - baby .birthday .year ,
299- ", " .join (interests ),
300- "; " .join (baby .education .values_list ("organization_name" , flat = True )),
301- baby .v2_speciality if baby .v2_speciality else baby .speciality ,
302- baby .email ,
282+ ed .user .first_name + " " + ed .user .last_name ,
283+ (today .year - ed .user .birthday .year )
284+ if ed .user .birthday .year
285+ else None ,
286+ ed .organization_name ,
287+ ed .user .speciality_v2
288+ if ed .user .speciality_v2
289+ else ed .user .speciality ,
290+ ed .user .email ,
303291 ]
304292 )
305293
306- for big_man in big_mans :
307- industry_names = [
308- collab .project .industry .name if collab .project .industry else ""
309- for collab in big_man .collaborations .all ()
310- ]
311- response_data .append (
312- [
313- big_man .first_name + " " + big_man .last_name ,
314- today .year - big_man .birthday .year ,
315- ", " .join (industry_names ),
316- "; " .join (big_man .education .values_list ("organization_name" , flat = True )),
317- big_man .v2_speciality
318- if big_man .v2_speciality
319- else big_man .speciality ,
320- big_man .email ,
321- ]
322- )
294+ # for baby in little_mans:
295+ # interests = [
296+ # collab.project.industry.name if collab.project.industry else ""
297+ # for collab in baby.collaborations.all()
298+ # ]
299+ # if not len(interests):
300+ # interests = [
301+ # skill_to_obj.skill.name if skill_to_obj.skill else ""
302+ # for skill_to_obj in baby.skills.all()
303+ # ]
304+ # if not len(interests):
305+ # interests = baby.key_skills.split(",") if baby.key_skills else []
306+ # response_data.append(
307+ # [
308+ # baby.first_name + " " + baby.last_name,
309+ # today.year - baby.birthday.year,
310+ # ", ".join(interests),
311+ # "; ".join(baby.education.values_list("organization_name", flat=True)),
312+ # baby.v2_speciality if baby.v2_speciality else baby.speciality,
313+ # baby.email,
314+ # ]
315+ # )
316+ #
317+ # for big_man in big_mans:
318+ # industry_names = [
319+ # collab.project.industry.name if collab.project.industry else ""
320+ # for collab in big_man.collaborations.all()
321+ # ]
322+ # response_data.append(
323+ # [
324+ # big_man.first_name + " " + big_man.last_name,
325+ # today.year - big_man.birthday.year,
326+ # ", ".join(industry_names),
327+ # "; ".join(big_man.education.values_list("organization_name", flat=True)),
328+ # big_man.v2_speciality
329+ # if big_man.v2_speciality
330+ # else big_man.speciality,
331+ # big_man.email,
332+ # ]
333+ # )
323334
324335 # для малолеток указать теги проектов, если нет - навыки
325336 # для старших - специальность, вуз, учебное заведение
0 commit comments