[FIX] website_forum: correct goal definition and other improvement

- scholar: the field is_correct is on the answer, not on the question
- remove closing reason 'an answer was accepted', the questions should be left as open to be possible to improve the answer afterward
- sort badges by most frequent first
- display the creation date of the question the same way we display the answer date
This commit is contained in:
Martin Trigaux
2014-05-20 15:27:33 +02:00
5 changed files with 7 additions and 8 deletions
+1
View File
@@ -599,6 +599,7 @@ class WebsiteForum(http.Controller):
Badge = request.registry['gamification.badge']
badge_ids = Badge.search(cr, SUPERUSER_ID, [('challenge_ids.category', '=', 'forum')], context=context)
badges = Badge.browse(cr, uid, badge_ids, context=context)
badges = sorted(badges, key=lambda b: b.stat_count_distinct, reverse=True)
values = self._prepare_forum_values(forum=forum, searches={'badges': True})
values.update({
'badges': badges,
@@ -78,16 +78,16 @@
<field name="target_goal">10</field>
</record>
<!-- Pundit: 10 comments with at least score of 10 -->
<!-- Pundit: 10 answers with at least score of 10 -->
<record id="badge_25" model="gamification.badge">
<field name="name">Pundit</field>
<field name="description">Left comments with score of 10 or more</field>
<field name="description">Left 10 answers with score of 10 or more</field>
<field name="level">silver</field>
<field name="rule_auth">nobody</field>
</record>
<record model="gamification.goal.definition" id="definition_pundit">
<field name="name">Pundit</field>
<field name="description">Post 10 comments with score of 10 or more</field>
<field name="description">Post 10 answers with score of 10 or more</field>
<field name="display_mode">boolean</field>
<field name="condition">higher</field>
<field name="model_id" eval="ref('website_forum.model_forum_post')"/>
@@ -372,7 +372,7 @@
<field name="computation_mode">count</field>
<field name="display_mode">boolean</field>
<field name="model_id" eval="ref('website_forum.model_forum_post')" />
<field name="domain">[('parent_id', '=', False), ('is_correct', '=', True)]</field>
<field name="domain">[('parent_id', '=', False), ('has_validated_answer', '=', True)]</field>
<field name="condition">higher</field>
<field name="batch_mode">True</field>
<field name="batch_distinctive_field" eval="ref('website_forum.field_forum_post_create_uid')" />
-3
View File
@@ -70,9 +70,6 @@
<record id="reason_4" model="forum.post.reason">
<field name="name">not a real question</field>
</record>
<record id="reason_5" model="forum.post.reason">
<field name="name">already answered and an answer was accepted</field>
</record>
<record id="reason_6" model="forum.post.reason">
<field name="name">not relevant or out dated</field>
</record>
+2 -1
View File
@@ -436,7 +436,7 @@
</h1>
<div class="alert alert-info text-center" t-if="question.state == 'close'">
<p class="mt16">
<b>The question has been closed for reason: <i t-esc="question.closed_reason_id.name"/></b>
<b>The question has been closed<t t-if="question.closed_reason_id"> for reason: <i t-esc="question.closed_reason_id.name"/></t></b>
</p>
<t t-if="question.closed_uid">
<b>by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ question.closed_uid.id }"
@@ -514,6 +514,7 @@
t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
style="display: inline-block;"/>
<div t-field="question.create_uid" t-field-options='{"widget": "contact", "badges": true, "fields": ["karma"]}'/>
<span class="text-muted">Asked on <span t-field="question.create_date" t-field-options='{"format":"short"}'/></span>
</div>
</div>
</div>