ソースを参照

shown all replies to the frontand

Mohidul Islam 5 年 前
コミット
9d90886dc5

+ 1 - 1
dashboard/static/main.css

@@ -92,7 +92,7 @@ a.article-title:hover {
    position: fixed;
    max-height: 80%;
    overflow: auto;
-   width: 18%;
+   width: 24%;
 }
 
 

+ 25 - 0
dashboard/templates/_reportsidebar.html

@@ -30,6 +30,31 @@
       </div>
   </div>
 </div>
+<!--  ================================================================================================================================-->
+<!--  This is for temporary use, It will be remove in future release.-->
+<!--  This part of code block is used for show all reviews as intent classifier make mistake sometime. -->
+  <div class="card">
+  <div class="card-body">
+    <h5 class="card-title">Not classified</h5>
+    <hr>
+        {% for key, data in replies2.items %}
+        <div class="card">
+          <h5 class="card-header">{{key}}</h5>
+          <div class="card-body" style="padding: 1px">
+            <ul class="list-group list-group-item-action">
+                {% for reply in data %}
+                  <li class="list-group-item" style="font-size: 14px" ><p>{{ reply.reply }}</p></li>
+                {% endfor %}
+            </ul>
+        </div>
+      {% endfor %}
+      </div>
+  </div>
+  </div>
+
+<!--  End of the temporary code block-->
+<!--  ================================================================================================================================-->
+
 </div>
 
 

+ 2 - 2
dashboard/templates/base.html

@@ -48,10 +48,10 @@
         {% block report %} {% endblock %}
         </div>
       <div class="row">
-        <div class="col-md-8">
+        <div class="col-md-7">
           {% block content %}{% endblock %}
         </div>
-        <div class="col-md-4">
+        <div class="col-md-5">
             <div class="scrollable-section">
                 {% if intents %}
                   {% include '_reportsidebar.html' %}

+ 31 - 6
nlu_job/views.py

@@ -30,15 +30,40 @@ def predict_report(request, review_id):
         reviews = paginator.page(1)
     except EmptyPage:
         reviews = paginator.page(paginator.num_pages)
-    replies = {}
-    for intent in intents.keys():
-        r = CustomReply.objects.filter(reply_category=intent)
-        filtered_replies = filter_with_last_ten_reviews(location_id, r)
-        replies[intent] = filtered_replies
+    if review.star_rating == 5:
+        replies = {}
+        for intent in intents.keys():
+            r = CustomReply.objects.filter(reply_category=intent)
+            filtered_replies = filter_with_last_ten_reviews(location_id, r)
+            replies[intent] = filtered_replies
+
+        # ================================================================================================================================
+        # This is for temporary use, It will be remove in future release.
+        # This part of code block is used for show all reviews as intent classifier make mistake sometime.
+        replies2 = {}
+        rep_cls = {'staff', 'facility', 'kids', 'quick', 'general_review', 'open_24', 'continuous_visit'}.difference(set(intents.keys()))
+        for c in rep_cls:
+            r = CustomReply.objects.filter(reply_category=c)
+            filtered_replies = filter_with_last_ten_reviews(location_id, r)
+            replies2[c] = filtered_replies
+
+        # End of the temporary code block
+        # ================================================================================================================================
+    else:
+        cr = CustomReply.objects.values('reply_category').distinct()
+        cr_li = {c_r['reply_category'] for c_r in cr}
+        rep_cls = cr_li.difference({'staff', 'facility', 'kids', 'quick', 'general_review', 'open_24', 'continuous_visit', 'no_comment'})
+        replies = {}
+        replies2 = None
+        for c in rep_cls:
+            r = CustomReply.objects.filter(reply_category=c)
+            filtered_replies = filter_with_last_ten_reviews(location_id, r)
+            replies[c] = filtered_replies
     context = {
         'reviews': reviews,
         'form': form,
         'intents': intents,
-        'replies': replies
+        'replies': replies,
+        'replies2': replies2         # This context is associate with the temporary code that mentioned above.
     }
     return render(request, 'dashboard.html', context)

+ 1 - 1
review_automation/settings.py

@@ -10,7 +10,7 @@ SECRET_KEY = '0t@j@klm8b@2rdl@po$$24pirh$&cg#p6f#)@$@n8^kn7k2%9b'
 # SECURITY WARNING: don't run with debug turned on in production!
 DEBUG = True
 
-ALLOWED_HOSTS = ['10.0.0.17', '127.0.0.1']
+ALLOWED_HOSTS = ['10.0.0.25', '127.0.0.1']
 
 
 # Application definition

+ 1 - 1
static_root/main.css

@@ -92,7 +92,7 @@ a.article-title:hover {
    position: fixed;
    max-height: 80%;
    overflow: auto;
-   width: 18%;
+   width: 24%;
 }