Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-21-2013, 10:40 PM
Justin M Justin M is offline
 
Join Date: Dec 2012
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Based on Post Count

I'm wanting to create a template edit on my sports forum for "MLB ERA" - The more the member posts the lower the ERA goes down.

If you do not know what MLB ERA is:
http://www.ehow.com/how_9733_calculate-earned-run.html

What would I need to do to accomplish this?
Reply With Quote
  #2  
Old 02-22-2013, 03:30 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It sounds like it's very similar to "posts per day" that this site displays, except lower is better. So I guess you'd have to figure out how you want to calculate that. I suppose you could do something like decide that N or more posts per day is "perfect", then calculate the number of posts per day for a user and subtract from N (although then anyone with N or more posts per day would have an "era" of 0, so maybe you need something like 1/PPD instead?).

As for actually implementing it, you'd probably need a plugin to calculate it. If you only want to display it in the postbit then you could use postbit_display_complete and use the values in $post (which should contain the author's data), and set $post['era'] or something like that.
Reply With Quote
  #3  
Old 02-22-2013, 07:25 PM
Justin M Justin M is offline
 
Join Date: Dec 2012
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks kh99! Seems like a very simple task, but I'm a beginner so I'll need a little help.

Will you help me with the plugin, as I'm not sure.
Reply With Quote
  #4  
Old 02-22-2013, 10:24 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think it's probably only a few lines so I could do that, if you can tell me exactly how you want to calculate it. Do you want it to be a "lifetime" value? Hopefully that's OK because it's easy enough to get the time since a user joined and the total posts since they've joined, otherwise it gets more difficult. But one issue with it being a lifetime value is that it of course gets harder and harder to change as time goes on.
Reply With Quote
  #5  
Old 02-22-2013, 10:28 PM
Justin M Justin M is offline
 
Join Date: Dec 2012
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes lifetime value is okay - anything that's easy enough for you. Just make it go along with the ERA, the link I posted above. This will be greatly appreciated!
Reply With Quote
  #6  
Old 02-24-2013, 07:11 PM
Justin M Justin M is offline
 
Join Date: Dec 2012
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

kh99, I'm not replying to disturb you if you're busy but about long will it take you to get the plugin done? I'm interested in adding this asap. Thanks much!

-Justin
Reply With Quote
  #7  
Old 02-24-2013, 07:15 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's OK, it's good to remind me. But I had been hoping you'd specify how you wanted it calculated. The plugin's not an issue, it's figuring out the equation. Like I mentioned above, it doesn't really translate exactly because with era low is good. If you picked a certain number of posts per day or week that you wanted for someone to be "perfect" then a lot of people would probably have 0.00, which I figured you wouldn't want.

I can probably figure out something that works but I need to think about it.
Reply With Quote
  #8  
Old 02-24-2013, 07:19 PM
mokujin's Avatar
mokujin mokujin is offline
 
Join Date: Oct 2005
Location: Czech
Posts: 345
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What does "Earned Run Average" mean in MLB? I'm from Europe and only watch Football
Reply With Quote
  #9  
Old 02-24-2013, 07:51 PM
Justin M Justin M is offline
 
Join Date: Dec 2012
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks kh99!

per predictem
Quote:
Add up a pitchers innings. An inning is three outs. If you see 6.1 or 6.2 that means 6.33 or 6.67 innings. Unlike some other baseball stats, we don't round up when we're talking about ERA.

Now add up all the earned runs the pitcher gave up during the innings he's pitched. For arguments sake, lets say he gave up 3 earned runs.

Now multiply the earned runs by 9.

Now divide by the total innings pitched.

Example: A pitcher goes 5 innings and gives up 3 earned runs. We take the earned runs x 9 which gives us 27. We then divide this by the innings pitched 27 divided by 5 = 5.40.
In case you're wondering what the good, bad and the ugly are ERA-wise in the big leagues it could be said that:

An earned run average of 2.00 or lower is an ace and a very sharp pitcher. Anything 3.00 or under is ROCK solid. An ERA of 3.00 to 3.50 is GOOD. Conversely, 4.00 to 5.00 is average and anything above 5.00 a guy is probably struggling to stay in the bigs and is getting hit pretty hard.
If you can figure out how to make the users posts go along with the time registered to show the ERA (I think I'm on the right path), that is pure genius. I'm not that good with equations.

mokujin, ERA or earned run average, is another way of saying "what a pitcher gives up per nine innings that he pitches."
Reply With Quote
  #10  
Old 02-25-2013, 05:30 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was hoping mokujin might decide to come up with something. Anyway, it's actually a pretty simple plugin, you just need to create a new plugin using hook postbit_display_complete and code something like:
Code:
if (!$post['posts'])
   $post['era'] = "No Posts Yet";
else
{
   $days = $post['joindateline'] / (3600 * 24); // 3600 * 24 = seconds in a day
   $era = $days / $post['posts'];
   $post['era'] = vb_number_format($era, 2);
}

Then use {vb:raw post.era} in your postbit or postbit_legacy template.

This just uses 1/posts per day so that lower is "better", but I'm kind of guessing that's going to give values for some users that don't look like reasonable ERA values, so you'll probably want some tweaking.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:39 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04589 seconds
  • Memory Usage 2,251KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete