def player_list(request): data = { 'colorThresholds' : ColorThreshold.as_json(), 'player_columns' : PLAYERS_COLUMNS, 'datatables_defaults' : DATATABLES_DEFAULTS, } return render_to_response("ecm/hr/players/player_list.html", data, Ctx(request))
def player_list(request): data = { 'colorThresholds': ColorThreshold.as_json(), 'player_columns': PLAYERS_COLUMNS, 'datatables_defaults': DATATABLES_DEFAULTS, } return render_to_response("ecm/hr/players/player_list.html", data, Ctx(request))
def changes(request): data = { 'scan_date' : UpdateDate.get_latest(TitleComposition), 'columns': DIFFS_COLUMNS, 'datatables_defaults': DATATABLES_DEFAULTS, "colorThresholds" : ColorThreshold.as_json(), } return render_to_response("ecm/hr/titles/changes.html", data, Ctx(request))
def changes(request): data = { 'scan_date': UpdateDate.get_latest(TitleComposition), 'columns': DIFFS_COLUMNS, 'datatables_defaults': DATATABLES_DEFAULTS, "colorThresholds": ColorThreshold.as_json(), } return render_to_response("ecm/hr/titles/changes.html", data, Ctx(request))
def roles(request): data = { 'colorThresholds': ColorThreshold.as_json(), 'role_types': RoleType.objects.all().order_by('id'), 'role_type': request.GET.get('role_type', 1), 'columns': ROLES_COLUMNS, 'datatables_defaults': DATATABLES_DEFAULTS, } return render_to_response("ecm/hr/roles/roles.html", data, Ctx(request))
def members(request, title_id): data = { 'title' : get_object_or_404(Title, pk=int(title_id)), 'colorThresholds' : ColorThreshold.as_json(), 'directorAccessLvl' : Member.DIRECTOR_ACCESS_LVL, 'columns': MEMBERS_COLUMNS, 'datatables_defaults': DATATABLES_DEFAULTS } return render_to_response("ecm/hr/titles/title_members.html", data, Ctx(request))
def player_details(request, player_id): player = get_object_or_404(User, id=int(player_id)) try: player = User.objects.select_related(depth=1).get(id=int(player_id)) except User.DoesNotExist: raise Http404() eve_accounts = player.eve_accounts.all().count() characters = player.characters.all().count() groups = player.groups.all().order_by('id') reference = '' try: player.user counter = 1 count = player.user.reference.all().all().count() if count > 0: for r in player.user.reference.all().all(): url = '/hr/players/%d/' % r.id reference += '<a href="%s" class="player">%s</a>' % ( url, r.username) if counter < count: reference += ', ' counter += 1 else: reference = '-' except Recruit.DoesNotExist: reference = '-' try: if player.user.recruiter and player.user.recruiter.characters.all( ).count() > 0: recruiter = player.user.recruiter.characters.all( )[0].owner_permalink else: recruiter = '-' except Recruit.DoesNotExist: recruiter = '-' data = { 'player': player, 'eve_accounts': eve_accounts, 'characters': characters, 'groups': groups, 'reference': reference, 'recruiter': recruiter, 'colorThresholds': ColorThreshold.as_json(), 'directorAccessLvl': Member.DIRECTOR_ACCESS_LVL, 'player_columns': MEMBERS_COLUMNS, 'datatables_defaults': DATATABLES_DEFAULTS, } return render_to_response('ecm/hr/players/player_details.html', data, Ctx(request))
def unassociated(request): data = { 'scan_date' : UpdateDate.get_latest(Member), 'colorThresholds' : ColorThreshold.as_json(), 'directorAccessLvl' : Member.DIRECTOR_ACCESS_LVL, 'datatables_defaults': DATATABLES_DEFAULTS, 'columns': MEMBERS_COLUMNS, 'ajax_url': '/hr/members/unassociated/data/', } return render_to_response("ecm/hr/members/unassociated.html", data, Ctx(request))
def members(request, title_id): data = { 'title': get_object_or_404(Title, pk=int(title_id)), 'colorThresholds': ColorThreshold.as_json(), 'directorAccessLvl': Member.DIRECTOR_ACCESS_LVL, 'columns': MEMBERS_COLUMNS, 'datatables_defaults': DATATABLES_DEFAULTS } return render_to_response("ecm/hr/titles/title_members.html", data, Ctx(request))
def unassociated(request): data = { 'scan_date': UpdateDate.get_latest(Member), 'colorThresholds': ColorThreshold.as_json(), 'directorAccessLvl': Member.DIRECTOR_ACCESS_LVL, 'datatables_defaults': DATATABLES_DEFAULTS, 'columns': MEMBERS_COLUMNS, 'ajax_url': '/hr/members/unassociated/data/', } return render_to_response("ecm/hr/members/unassociated.html", data, Ctx(request))
def details(request, title_id): title = get_object_or_404(Title, pk=int(title_id)) if title.title_compo_diffs.all(): title.lastModified = print_time_min(title.title_compo_diffs.latest('id')) else: title.lastModified = None title.color = ColorThreshold.get_access_color(title.accessLvl) data = { "title" : title, "member_count" : title.members.count(), "colorThresholds" : ColorThreshold.as_json(), 'roles_columns': ROLES_COLUMNS, 'diffs_columns': DIFFS_COLUMNS, 'datatables_defaults': DATATABLES_DEFAULTS } return render_to_response("ecm/hr/titles/title_details.html", data, Ctx(request))
def access_changes(request): data = { 'scan_date' : UpdateDate.get_latest(TitleMembership), 'colorThresholds' : ColorThreshold.as_json(), 'directorAccessLvl': Member.DIRECTOR_ACCESS_LVL, 'datatable_defaults': DATATABLES_DEFAULTS, 'columns' : ACCESS_CHANGES_COLUMNS, 'sorting': [[3, 'desc']], 'ajax_url': '/hr/members/accesschanges/data/', } return render_to_response("ecm/hr/members/access_changes.html", data, Ctx(request))
def player_details(request, player_id): player = get_object_or_404(User, id=int(player_id)) try: player = User.objects.select_related(depth=1).get(id=int(player_id)) except User.DoesNotExist: raise Http404() eve_accounts = player.eve_accounts.all().count() characters = player.characters.all().count() groups = player.groups.all().order_by('id') reference = '' try: player.user counter = 1 count = player.user.reference.all().all().count() if count > 0: for r in player.user.reference.all().all(): url = '/hr/players/%d/' % r.id reference += '<a href="%s" class="player">%s</a>' % (url, r.username) if counter < count: reference += ', ' counter += 1 else: reference = '-' except Recruit.DoesNotExist: reference = '-' try: if player.user.recruiter and player.user.recruiter.characters.all().count() > 0: recruiter = player.user.recruiter.characters.all()[0].owner_permalink else: recruiter = '-' except Recruit.DoesNotExist: recruiter = '-' data = { 'player': player, 'eve_accounts' : eve_accounts, 'characters' : characters, 'groups' : groups, 'reference' : reference, 'recruiter' : recruiter, 'colorThresholds' : ColorThreshold.as_json(), 'directorAccessLvl' : Member.DIRECTOR_ACCESS_LVL, 'player_columns' : MEMBERS_COLUMNS, 'datatables_defaults' : DATATABLES_DEFAULTS, } return render_to_response('ecm/hr/players/player_details.html', data, Ctx(request))
def access_changes(request): data = { 'scan_date': UpdateDate.get_latest(TitleMembership), 'colorThresholds': ColorThreshold.as_json(), 'directorAccessLvl': Member.DIRECTOR_ACCESS_LVL, 'datatable_defaults': DATATABLES_DEFAULTS, 'columns': ACCESS_CHANGES_COLUMNS, 'sorting': [[3, 'desc']], 'ajax_url': '/hr/members/accesschanges/data/', } return render_to_response("ecm/hr/members/access_changes.html", data, Ctx(request))
def journal(request): walletID = int(request.GET.get('walletID', 0)) entryTypeID = int(request.GET.get('entryTypeID', 0)) amount = request.GET.get('amount', None) comparator = request.GET.get('comparator', '>') from_date = JournalEntry.objects.all().aggregate(date=Min("date"))["date"] if from_date is None: from_date = datetime.utcfromtimestamp(0) to_date = JournalEntry.objects.all().aggregate(date=Max("date"))["date"] if to_date is None: to_date = timezone.now() my_corp = Corporation.objects.mine() wallets = [{'walletID': 0, 'name': 'All', 'selected': walletID == 0}] for w in my_corp.wallets.all().order_by('wallet'): wallets.append({ 'walletID': w.wallet_id, 'name': w.name, 'selected': w.wallet_id == walletID }) entryTypes = [{ 'refTypeID': 0, 'refTypeName': 'All', 'selected': entryTypeID == 0 }] for et in EntryType.objects.exclude(refTypeID=0).exclude( refTypeName='').order_by('refTypeName'): entryTypes.append({ 'refTypeID': et.refTypeID, 'refTypeName': et.refTypeName, 'selected': et.refTypeID == entryTypeID }) data = { 'wallets': wallets, 'entryTypes': entryTypes, 'amount': amount, 'comparator': comparator, 'scan_date': UpdateDate.get_latest(JournalEntry), 'from_date': datetime.strftime(from_date, DATE_PATTERN), 'to_date': datetime.strftime(to_date, DATE_PATTERN), 'datatable_defaults': DATATABLES_DEFAULTS, 'columns': WALLET_JOURNAL_COLUMNS, 'colorThresholds': ColorThreshold.as_json(), 'ajax_url': '/accounting/journal/data/', } return render_to_response("ecm/accounting/wallet_journal.html", data, Ctx(request))
def details(request, title_id): title = get_object_or_404(Title, pk=int(title_id)) if title.title_compo_diffs.all(): title.lastModified = print_time_min( title.title_compo_diffs.latest('id')) else: title.lastModified = None title.color = ColorThreshold.get_access_color(title.accessLvl) data = { "title": title, "member_count": title.members.count(), "colorThresholds": ColorThreshold.as_json(), 'roles_columns': ROLES_COLUMNS, 'diffs_columns': DIFFS_COLUMNS, 'datatables_defaults': DATATABLES_DEFAULTS } return render_to_response("ecm/hr/titles/title_details.html", data, Ctx(request))
def members(request): corps = Corporation.objects.others().order_by('corporationName') corps = corps.annotate(member_count=Count('members')) data = { 'scan_date' : UpdateDate.get_latest(Member), 'trusted_corps': corps.filter(member_count__gt=0, is_trusted=True), 'other_corps': corps.filter(member_count__gt=0, is_trusted=False), 'colorThresholds' : ColorThreshold.as_json(), 'directorAccessLvl' : Member.DIRECTOR_ACCESS_LVL, 'datatables_defaults': DATATABLES_DEFAULTS, 'columns': MEMBERS_COLUMNS, 'ajax_url': '/hr/members/data/', } return render_to_response("ecm/hr/members/list.html", data, Ctx(request))
def members(request): corps = Corporation.objects.others().order_by('corporationName') corps = corps.annotate(member_count=Count('members')) data = { 'scan_date': UpdateDate.get_latest(Member), 'trusted_corps': corps.filter(member_count__gt=0, is_trusted=True), 'other_corps': corps.filter(member_count__gt=0, is_trusted=False), 'colorThresholds': ColorThreshold.as_json(), 'directorAccessLvl': Member.DIRECTOR_ACCESS_LVL, 'datatables_defaults': DATATABLES_DEFAULTS, 'columns': MEMBERS_COLUMNS, 'ajax_url': '/hr/members/data/', } return render_to_response("ecm/hr/members/list.html", data, Ctx(request))
def journal(request): walletID = int(request.GET.get('walletID', 0)) entryTypeID = int(request.GET.get('entryTypeID', 0)) amount = request.GET.get('amount',None) comparator = request.GET.get('comparator','>') from_date = JournalEntry.objects.all().aggregate(date=Min("date"))["date"] if from_date is None: from_date = datetime.utcfromtimestamp(0) to_date = JournalEntry.objects.all().aggregate(date=Max("date"))["date"] if to_date is None: to_date = timezone.now() my_corp = Corporation.objects.mine() wallets = [{ 'walletID' : 0, 'name' : 'All', 'selected' : walletID == 0 }] for w in my_corp.wallets.all().order_by('wallet'): wallets.append({ 'walletID' : w.wallet_id, 'name' : w.name, 'selected' : w.wallet_id == walletID }) entryTypes = [{ 'refTypeID' : 0, 'refTypeName' : 'All', 'selected' : entryTypeID == 0 }] for et in EntryType.objects.exclude(refTypeID=0).exclude(refTypeName='').order_by('refTypeName'): entryTypes.append({ 'refTypeID' : et.refTypeID, 'refTypeName' : et.refTypeName, 'selected' : et.refTypeID == entryTypeID }) data = { 'wallets' : wallets, 'entryTypes' : entryTypes, 'amount' : amount, 'comparator' : comparator, 'scan_date' : UpdateDate.get_latest(JournalEntry), 'from_date' : datetime.strftime(from_date, DATE_PATTERN), 'to_date' : datetime.strftime(to_date, DATE_PATTERN), 'datatable_defaults': DATATABLES_DEFAULTS, 'columns': WALLET_JOURNAL_COLUMNS, 'colorThresholds': ColorThreshold.as_json(), 'ajax_url':'/accounting/journal/data/', } return render_to_response("ecm/accounting/wallet_journal.html", data, Ctx(request))
def role(request, role_id): try: role = get_object_or_404(Role, pk=int(role_id)) except ValueError: raise Http404() role.accessLvl = role.get_access_lvl() data = { 'colorThresholds' : ColorThreshold.as_json(), 'directorAccessLvl' : Member.DIRECTOR_ACCESS_LVL, 'role_types' : RoleType.objects.all(), 'role' : role, 'ajax_url': '/hr/roles/%d/data/' % role.id, 'direct_member_count' : role.members.count(), 'total_member_count' : role.members_through_titles().count(), 'columns': MEMBERS_COLUMNS, 'datatables_defaults': DATATABLES_DEFAULTS, } return render_to_response("ecm/hr/roles/role_details.html", data, Ctx(request))
def journal(request): walletID = int(request.GET.get("walletID", 0)) entryTypeID = int(request.GET.get("entryTypeID", 0)) amount = request.GET.get("amount", None) comparator = request.GET.get("comparator", ">") from_date = JournalEntry.objects.all().aggregate(date=Min("date"))["date"] if from_date is None: from_date = datetime.utcfromtimestamp(0) to_date = JournalEntry.objects.all().aggregate(date=Max("date"))["date"] if to_date is None: to_date = timezone.now() my_corp = Corporation.objects.mine() wallets = [{"walletID": 0, "name": "All", "selected": walletID == 0}] for w in my_corp.wallets.all().order_by("wallet"): wallets.append({"walletID": w.wallet_id, "name": w.name, "selected": w.wallet_id == walletID}) entryTypes = [{"refTypeID": 0, "refTypeName": "All", "selected": entryTypeID == 0}] for et in EntryType.objects.exclude(refTypeID=0).exclude(refTypeName="").order_by("refTypeName"): entryTypes.append( {"refTypeID": et.refTypeID, "refTypeName": et.refTypeName, "selected": et.refTypeID == entryTypeID} ) data = { "wallets": wallets, "entryTypes": entryTypes, "amount": amount, "comparator": comparator, "scan_date": UpdateDate.get_latest(JournalEntry), "from_date": datetime.strftime(from_date, DATE_PATTERN), "to_date": datetime.strftime(to_date, DATE_PATTERN), "datatable_defaults": DATATABLES_DEFAULTS, "columns": WALLET_JOURNAL_COLUMNS, "colorThresholds": ColorThreshold.as_json(), "ajax_url": "/accounting/journal/data/", } return render_to_response("ecm/accounting/wallet_journal.html", data, Ctx(request))
def details(request, characterID): avg_session = { 'sessionlength': 0, '30days': 0, '7days': 0, } now = timezone.now() try: member = Member.objects.get(characterID=int(characterID)) try: member.base = CelestialObject.objects.get(itemID=member.baseID).itemName except CelestialObject.DoesNotExist: member.base = str(member.baseID) member.color = ColorThreshold.get_access_color(member.accessLvl) member.roles_no_director = member.roles.exclude(roleID=1) # exclude 'director' query = MemberSession.objects.filter(character_id=member.characterID).order_by('session_begin') query_30 = query.filter(session_begin__gt=now - timedelta(30)) query_7 = query.filter(session_begin__gt=now - timedelta(7)) session_len = query.aggregate(len=Avg('session_seconds'))['len'] or 0 session_len_30 = query_30.aggregate(len=Avg('session_seconds'))['len'] or 0 session_len_7 = query_7.aggregate(len=Avg('session_seconds'))['len'] or 0 # Totals total = query.aggregate(len=Sum('session_seconds'))['len'] or 0 lastWeek = query_7.aggregate(len=Sum('session_seconds'))['len'] or 0 lastMonth = query_30.aggregate(len=Sum('session_seconds'))['len'] or 0 loginhistory = query.order_by('-session_begin')[:10] avg_session['sessionlength'] = timedelta(seconds=session_len) avg_session['30days'] = timedelta(seconds=session_len_30) avg_session['7days'] = timedelta(seconds=session_len_7) if member.corp_id == Corporation.objects.mine().corporationID: member.date = UpdateDate.get_latest(Member) else: try: d = MemberDiff.objects.filter(member=member, new=False).order_by("-id")[0] member.date = d.date except IndexError: member.date = 0 skills, skill_count, skillpoint_count = get_skills(member) except Member.DoesNotExist: member = Member(characterID=int(characterID), name="???") try: killboardUrl = Setting.get('corp_killboard_url') except Setting.DoesNotExist: killboardUrl = None data = { 'member' : member, 'killboardUrl' : killboardUrl, 'sessiondata' : avg_session, 'lastWeek' : lastWeek, 'lastMonth' : lastMonth, 'total' : total, 'logins' : loginhistory, 'skills_tree' : json.dumps(skills), 'skill_count' : skill_count, 'skillpoint_count' : print_integer(skillpoint_count), 'datatables_defaults': DATATABLES_DEFAULTS, 'access_columns' : ACCESS_CHANGES_COLUMNS, 'sorting' : [[2, 'desc']], } return render_to_response("ecm/hr/members/details.html", data, Ctx(request))