<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Question2Answer Q&amp;A - Recent questions tagged patch</title>
<link>https://www.question2answer.org/qa/tag/patch</link>
<description>Powered by Question2Answer</description>
<item>
<title>Plugin/Patch request:  qa_usercategorypoints</title>
<link>https://www.question2answer.org/qa/17591/plugin-patch-request-qa_usercategorypoints</link>
<description>

&lt;p&gt;
	So I want code, a plugin or a patch, that will calculate points and put them in qa_usercategorypoints. &amp;nbsp;All the logic should be identical to the logic for populating qa_userpoints except, each user will have multiple records based on the category they interacted with. &amp;nbsp;If they create a question without a category or interact with a question that has no category, then the categoryid for that record will be 0. &amp;nbsp;If they interact with a subcategory, the ancestor categoryid whose parentid is null will be used. &amp;nbsp;Basically, this will allow a user browsing a category or subcategory to see which user is the 'expert' of that category.&lt;/p&gt;


&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;


&lt;div&gt;
	Here is the table I want to use:&lt;/div&gt;


&lt;div&gt;
	delimiter $$&lt;/div&gt;


&lt;div&gt;
	CREATE TABLE `qa_usercategorypoints` (&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `userid` int(10) unsigned NOT NULL,&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `categoryid` int(10) unsigned NOT NULL, /* if they post to a category that has a parentid go down the tree until we get the parent category with a null parentid that categoryid goes here */&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `points` int(11) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `qposts` mediumint(9) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `aposts` mediumint(9) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `cposts` mediumint(9) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `aselects` mediumint(9) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `aselecteds` mediumint(9) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `qupvotes` mediumint(9) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `qdownvotes` mediumint(9) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `aupvotes` mediumint(9) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `adownvotes` mediumint(9) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `qvoteds` int(11) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `avoteds` int(11) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `upvoteds` int(11) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `downvoteds` int(11) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; `bonus` int(11) NOT NULL DEFAULT '0',&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; PRIMARY KEY (`userid`,`categoryid`),&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp; KEY `points` (`points`)&lt;/div&gt;


&lt;div&gt;
	) ENGINE=InnoDB DEFAULT CHARSET=utf8$$&lt;/div&gt;


&lt;div&gt;
	&amp;nbsp;&lt;/div&gt;


&lt;div&gt;
	I'm just having trouble wrapping my head around the way the inserts are generated. &amp;nbsp;If I figure out how to implement this before someone answers my question, I'll answer my own question and post the code here. &amp;nbsp;(I just figure that someone else may have already implemented this or can implement it faster than me)&lt;/div&gt;</description>
<category>Q2A Core</category>
<guid isPermaLink="true">https://www.question2answer.org/qa/17591/plugin-patch-request-qa_usercategorypoints</guid>
<pubDate>Wed, 05 Sep 2012 14:06:03 +0000</pubDate>
</item>
</channel>
</rss>