Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Staff Activity (https://forums.graalonline.com/forums/showthread.php?t=134267113)

Twinny 09-13-2012 05:51 AM

Staff Activity
 
This would be most helpful in Testbed but I can see value everywhere else.

I would like a RC function which will output all current accounts in the stafflist along with the last time they logged in. I'd also like the ability to optionally extend this to include the last 3 entries in their staff activity.

Thoughts?

Sinkler 09-13-2012 06:04 AM

You could in theory always ask a PWA...

Twinny 09-13-2012 06:17 AM

Quote:

Originally Posted by Sinkler (Post 1703707)
You could in theory always ask a PWA...

Slow process! I think a pre-formatted list available would be great!

DustyPorViva 09-13-2012 06:22 AM

There's already staff activity in /openaccess, it just needs to be expanded to include more than just NC activity.

Twinny 09-13-2012 06:30 AM

Quote:

Originally Posted by DustyPorViva (Post 1703709)
There's already staff activity in /openaccess, it just needs to be expanded to include more than just NC activity.

I know but I want an overview of all staff members added in staff options with a quick one line command :o

[Edit]: Testbed -> Currently 457 staff registered in server options

I'm trying to remove inactive people but it's a horrid manual process. Anything to speed it up would be awesome!

fowlplay4 09-13-2012 03:32 PM

Download the rclog and then to populate last login dates through it then use Testbed's time-online tracking (or whatever it's called) system to track future login dates.

xAndrewx 09-13-2012 09:26 PM

notepad++ is your friend

BlueMelon 09-13-2012 11:53 PM

Whiped up a little python script:

PHP Code:


#Copy/Paste your staff= into this string here:
server_staff "MonkeyBob,BlueMelon,Crow,Stefan"


months = ['Jan','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
open("rclog.txt",'r')
log f.readlines()
f.close()
staff server_staff.split(",")
times = {}
for 
s in staff:
    
times[s] = 'Jan 01'

for i in range(0,len(log)):
    if (
i+1) >= len(log):
        break
    
line log[i]
    
line2 log[i+1]
    if 
"is logged in from" in line2 and "Client-RC" not in line2:
        
acc line2.split(" ")[0]
        if 
acc in staff:
            
currentmonth times[acc].split(" ")[0]
            
currentmonth_num months.index(currentmonth)
            
newmonth line.split(" ")[2]
            
newmonth_num months.index(newmonth)
            if 
newmonth_num >= currentmonth_num:
                
times[acc] = line[10:len(line2)-1]


for 
acc in times.keys():
    print 
"Last Login ("+acc+"): "+str(times[acc]) 

http://pastebin.com/5yVy0e7w


Output:
PHP Code:

Last Login (BlueMelon): Sep 13 23:11:23 2012

Last Login 
(MonkeyBob): Sep 13 15:31:56 2012

Last Login 
(Stefan): Jul 18 03:36:44 2012

Last Login 
(Crow): Sep 13 17:12:31 2012 


Crow 09-14-2012 08:31 AM

Melon! You're not even closing your file handle! :/

BlueMelon 09-14-2012 02:13 PM

Quote:

Originally Posted by Crow (Post 1703791)
Melon! You're not even closing your file handle! :/

Sorry I got to exited...

add log.close() at the end of the script

Tricxta 09-14-2012 02:27 PM

Quote:

Originally Posted by BlueMelon (Post 1703797)
Sorry I got to exited...

Yo man! that's my line

Crow 09-14-2012 03:01 PM

Quote:

Originally Posted by BlueMelon (Post 1703797)
Sorry I got to exited...

add log.close() at the end of the script

Won't work, since "log" is your list of lines, not the file handle. Instead:
PHP Code:

f   open("rclog.txt",'r')
log f.readlines()
f.close() 


BlueMelon 09-14-2012 06:51 PM

Quote:

Originally Posted by Crow (Post 1703799)
Won't work, since "log" is your list of lines, not the file handle. Instead:
PHP Code:

f   open("rclog.txt",'r')
log f.readlines()
f.close() 


After a bit of research,

PHP Code:

log open('rclog.txt','r').readlines() 

Will automatic close the file descriptor (handle) once the python garbage collector finds it.

Its better to explicitly use a variable handle, or a with-block but since its a small script that will only be ran once in a while, it doesn't really matter.
For bigger projects though, you would need to close it.

Crow 09-14-2012 07:14 PM

Quote:

Originally Posted by BlueMelon (Post 1703810)
After a bit of research,

PHP Code:

log open('rclog.txt','r').readlines() 

Will automatic close the file descriptor (handle) once the python garbage collector finds it.

Its better to explicitly use a variable handle, or a with-block but since its a small script that will only be ran once in a while, it doesn't really matter.
For bigger projects though, you would need to close it.

IT'S BAD PRACTICE *rant* I'M TELLING YOU! !pissed!

BlueMelon 09-14-2012 07:24 PM

Quote:

Originally Posted by Crow (Post 1703812)
IT'S BAD PRACTICE *rant* I'M TELLING YOU! !pissed!

I agree, but for small projects/scripts its acceptable.
:D

DustyPorViva 09-14-2012 07:34 PM

Quote:

Originally Posted by Crow (Post 1703812)
IT'S BAD PRACTICE *rant* I'M TELLING YOU! !pissed!

LISTEN WHAT I'M TELLING YOU. IT'S THE ONLY WAY.

http://24.media.tumblr.com/tumblr_ly...3o1_r1_500.gif

Skyld 09-14-2012 07:37 PM

Quote:

Originally Posted by BlueMelon (Post 1703810)
Will automatic close the file descriptor (handle) once the python garbage collector finds it.

Do not ever expect that garbage collection will "just" fix your problems. What if the behaviour of the garbage collector is changed in the future? What about when you try to learn a language without garbage collection?

BlueMelon 09-14-2012 10:09 PM

Quote:

Originally Posted by Skyld (Post 1703816)
Do not ever expect that garbage collection will "just" fix your problems. What if the behaviour of the garbage collector is changed in the future? What about when you try to learn a language without garbage collection?

Alright getting offtopic...
But yes, true.


All times are GMT +2. The time now is 12:57 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.