\r
def user_stats(request, user_id, user_view):\r
user = get_object_or_404(User, id=user_id)\r
- questions = Question.objects.extra(\r
- select={\r
- 'vote_count' : 'question.score',\r
- 'favorited_myself' : 'SELECT count(*) FROM favorite_question f WHERE f.user_id = %s AND f.question_id = question.id',\r
- 'la_user_id' : 'auth_user.id',\r
- 'la_username' : 'auth_user.username',\r
- 'la_user_gold' : 'forum_user.gold',\r
- 'la_user_silver' : 'forum_user.silver',\r
- 'la_user_bronze' : 'forum_user.bronze',\r
- 'la_user_reputation' : 'forum_user.reputation'\r
- },\r
- select_params=[user_id],\r
- tables=['question', 'auth_user', 'forum_user'],\r
- where=['NOT question.deleted AND question.author_id=%s AND question.last_activity_by_id = auth_user.id AND forum_user.user_ptr_id = auth_user.id'],\r
- params=[user_id],\r
- order_by=['-vote_count', '-last_activity_at']\r
- ).values('vote_count',\r
- 'favorited_myself',\r
- 'id',\r
- 'title',\r
- 'author_id',\r
- 'added_at',\r
- 'answer_accepted',\r
- 'answer_count',\r
- 'comment_count',\r
- 'view_count',\r
- 'favourite_count',\r
- 'summary',\r
- 'tagnames',\r
- 'vote_up_count',\r
- 'vote_down_count',\r
- 'last_activity_at',\r
- 'la_user_id',\r
- 'la_username',\r
- 'la_user_gold',\r
- 'la_user_silver',\r
- 'la_user_bronze',\r
- 'la_user_reputation')[:100]\r
\r
- answered_questions = Question.objects.extra(\r
+ questions = Question.objects.filter(deleted=False, author=user).order_by('-added_at')\r
+\r
+ answered_questions = Question.objects.filter(deleted=False, answers__author=user).distinct()\r
+\r
+ """answered_questions = Question.objects.extra(\r
select={\r
'vote_up_count' : 'answer.vote_up_count',\r
'vote_down_count' : 'answer.vote_down_count',\r
'vote_count',\r
'answer_count',\r
'vote_up_count',\r
- 'vote_down_count')[:100]\r
+ 'vote_down_count')[:100]"""\r
\r
up_votes = user.get_up_vote_count()\r
down_votes = user.get_down_vote_count()\r
votes_today = user.get_vote_count_today()\r
votes_total = int(settings.MAX_VOTES_PER_DAY)\r
\r
- question_id_set = set(map(lambda v: v['id'], list(questions))) \\r
- | set(map(lambda v: v['id'], list(answered_questions)))\r
+ #question_id_set = set(map(lambda v: v['id'], list(questions))) \\r
+ # | set(map(lambda v: v['id'], list(answered_questions)))\r
\r
- user_tags = Tag.objects.filter(questions__id__in = question_id_set)\r
+ user_tags = Tag.objects.filter(questions__author=user)\r
try:\r
from django.db.models import Count\r
awards = Award.objects.extra(\r
d:\osqa\dev\osqa\forum\models\user.py TIME: 2010-04-09 11:39:45,881 MSG: user.py:get_profile_link:126 in get profile link <a href="/users/4/evgeny-fadeev">Evgeny Fadeev</a>\r
d:\osqa\dev\osqa\forum\models\user.py TIME: 2010-04-09 11:39:45,927 MSG: user.py:get_profile_link:126 in get profile link <a href="/users/3/rickross">rickross</a>\r
d:\osqa\dev\osqa\forum\models\user.py TIME: 2010-04-09 11:39:45,943 MSG: user.py:get_profile_link:126 in get profile link <a href="/users/4/evgeny-fadeev">Evgeny Fadeev</a>\r
+d:\osqa\fromsvn\forum\models\user.py TIME: 2010-04-11 15:50:54,022 MSG: user.py:get_profile_link:126 in get profile link <a href="/users/3/rickross">rickross</a>\r
+d:\osqa\fromsvn\forum\models\user.py TIME: 2010-04-11 15:50:54,124 MSG: user.py:get_profile_link:126 in get profile link <a href="/users/51/dz_brandon">DZ_Brandon</a>\r
+d:\osqa\fromsvn\forum\models\user.py TIME: 2010-04-11 18:23:14,994 MSG: user.py:get_profile_link:126 in get profile link <a href="/users/66/dealsvista_com">DealsVista_com</a>\r
<facet type="django" name="Django">\r
<configuration>\r
<option name="rootFolder" value="$MODULE_DIR$" />\r
- <option name="templatesFolder" value="" />\r
- <option name="settingsModule" value="osqa" />\r
+ <option name="templatesFolder" value="$MODULE_DIR$/forum/skins/default/templates" />\r
+ <option name="settingsModule" value="settings.py" />\r
</configuration>\r
</facet>\r
</component>\r
- <component name="NewModuleRootManager">\r
+ <component name="NewModuleRootManager" inherit-compiler-output="false">\r
<content url="file://$MODULE_DIR$" />\r
<orderEntry type="inheritedJdk" />\r
<orderEntry type="sourceFolder" forTests="false" />\r