]> git.openstreetmap.org Git - osqa.git/commitdiff
user profile fixes
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sun, 11 Apr 2010 17:41:15 +0000 (17:41 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sun, 11 Apr 2010 17:41:15 +0000 (17:41 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@26 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/skins/default/templates/user_stats.html
forum/templatetags/question_list_tags.py
forum/views/users.py
log/django.osqa.log
osqa.iml

index 92b4a74447622345990a4b7b9dc9212843f6f532..bcb67e283747da871ae00c8de43a620543c78492 100644 (file)
@@ -4,6 +4,7 @@
 {% load extra_tags %}
 {% load extra_filters %}
 {% load humanize %}
+{% load question_list_tags %}
                {% block usercontent %}
        
         <a name="questions"></a>
                 {% endblocktrans %}
             </h2>
         {% endspaceless %}
-               {% include "users_questions.html" %}
+               <div class="user-stats-table">
+                   {% for question in questions %}
+                       {% question_list_item_extended question %}
+                   {% endfor %}
+               </div>
+               <br clear="all"/>
         <a name="answers"></a>
         {% spaceless %}
             <h2>
index 3ebb151095edb62f5f6dd3c63c04f0e65260c41b..6238bcea6d28ba290dff84e183b97d5dc9659799 100644 (file)
@@ -9,6 +9,10 @@ register = template.Library()
 def question_list_item(question):\r
     return {'question': question}\r
 \r
+@register.inclusion_tag('question_list/item_extended.html')\r
+def question_list_item_extended(question):\r
+    return {'question': question}\r
+\r
 @register.inclusion_tag('question_list/sort_tabs.html')\r
 def question_sort_tabs(sort_context):\r
     return sort_context\r
index 9d7df8e7ba3469a794a0fbb50e745afc183120aa..162ba2d214f8c484e3f5faca54de980dc7812e81 100644 (file)
@@ -145,46 +145,12 @@ def edit_user(request, id):
 \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
@@ -207,17 +173,17 @@ def user_stats(request, user_id, user_view):
                         '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
index 0a0aab37ca8c53ef5f6806a4f59613e98a25cb4e..c2fd27b3e40931a6eba2cabac31b6f3e5089e560 100644 (file)
@@ -2646,3 +2646,6 @@ d:\osqa\dev\osqa\forum\models\user.py TIME: 2010-04-09 11:39:45,875 MSG: user.py
 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
index 24046e319475abaffab74222b2342e76a5732c50..aa15d1094a943ac3d4a4cc5dba35f9d0efe12591 100644 (file)
--- a/osqa.iml
+++ b/osqa.iml
@@ -4,12 +4,12 @@
     <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