Skip to content

Commit

Permalink
total seconds spent approved (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
thenomain committed Mar 9, 2015
1 parent d42643b commit 79edec7
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions 8 - Chargen/8f - Approval System.txt
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,46 @@ cg/log
))


/*
-----------------------------------------------------------------------------
-- Function: Total Seconds Approved -----------------------------------------

How many seconds has someone been approved, not including unapproval periods?

We are cheating heavily, assuming that '_log.approval' will be formatted:
approve/unapprove/approve/unapprove/...

If it's going to include other information, the first segment will need
heavily re-coded.

--

0: dbref
l: length of time (generic register)
returns: number of seconds

*/


&f.total_secs_approved cg=
localize(
strcat(
setq( l, get( %0/_log.approval )),
setq( l, iter( %ql, elements( %i0, 2, : ), | )),
if( eq( mod( words( %ql ), 2 ), 1 ),
setq( l, cat( %ql, secs( )))
),

ladd(
iter(
lnum( 1, words( %ql ), , 2 ),
sub( element( %ql, inc( %i0 )), element( %ql, %i0 ))
)
)
)
)



// =============================================================================
// == DISPLAYS & FORMATTING ====================================================
Expand Down

0 comments on commit 79edec7

Please sign in to comment.