Milimetric has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/75874


Change subject: fixed up the csv upload validation layout
......................................................................

fixed up the csv upload validation layout

Change-Id: I96af03c73e94623b67302f334519bdc798a2049b
---
M tests/cohort_csvs/umapi_sample1.csv
M wikimetrics/controllers/cohorts.py
M wikimetrics/templates/csv_upload_review.html
3 files changed, 74 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/wikimetrics 
refs/changes/74/75874/1

diff --git a/tests/cohort_csvs/umapi_sample1.csv 
b/tests/cohort_csvs/umapi_sample1.csv
index 59c5cdc..212b071 100644
--- a/tests/cohort_csvs/umapi_sample1.csv
+++ b/tests/cohort_csvs/umapi_sample1.csv
@@ -1,3 +1,4 @@
 DarTar,
+Dan 
 
 
diff --git a/wikimetrics/controllers/cohorts.py 
b/wikimetrics/controllers/cohorts.py
index ba3023d..f03d609 100644
--- a/wikimetrics/controllers/cohorts.py
+++ b/wikimetrics/controllers/cohorts.py
@@ -399,7 +399,7 @@
         if normalized_user is None:
             app.logger.info(
                 'invalid user: {0} in project {1}'
-                .format(record['user_str'], normalized_project)
+                .format(record['raw_username'], normalized_project)
             )
             record['reason_invalid'] = 'invalid user_name / user_id: %s' % 
record['user_str']
             invalid.append(record)
diff --git a/wikimetrics/templates/csv_upload_review.html 
b/wikimetrics/templates/csv_upload_review.html
index b81de40..baa91a0 100644
--- a/wikimetrics/templates/csv_upload_review.html
+++ b/wikimetrics/templates/csv_upload_review.html
@@ -1,54 +1,84 @@
 {% extends "layout.html" %}
 {% block body %}
 
-{% if invalid %}
-<h4>In-Valid Users</h4>
-<table class="table table-striped">
-    <thead>
-        <tr>
-            <th>Username</th>
-            <th>Project</th>
-            <th>Reason Invalid</th>
-        </tr>
-    </thead>
-    <tbody data-bind="foreach: invalid">
-        <tr>
-            <td><a data-bind="text: username, attr: {href: link}" 
target="_blank"></a></td>
-            <td data-bind="text: project"></td>
-            <td data-bind="text: reason_invalid"></td>
-        </tr>
-    </tbody>
-</table>
 
-<h5>Try uploading again after fixing the issues</h5>
-{% include "csv_upload_form.html" %}
+{% set invalid_active = invalid %}
+{% set valid_active = not invalid and valid %}
+
+<h2>Upload Validation</h2>
+
+<p>
+{% if invalid and valid %}
+There were both valid and invalid users in your cohort.  You can either try 
again or upload only the valid users.
+{% elif invalid %}
+All of the users in your cohort were invalid.  Please try again.
+{% elif valid %}
+All of the users in your cohort were valid.  You can review and finish the 
upload.
 {% endif %}
+</p>
 
-<hr/>
+<div class="tabbable tabs">
+    <ul class="nav nav-tabs">
+        {% if invalid %}
+        <li{%if invalid_active%} class="active"{%endif%}>
+            <a href="#invalid" data-toggle="tab">Invalid Users</a>
+        </li>
+        {% endif %}
+        {% if valid %}
+        <li{%if valid_active%} class="active"{%endif%}>
+            <a href="#valid" data-toggle="tab">Valid Users</a>
+        </li>
+        {% endif %}
+    </ul>
+    <div class="tab-content">
+        {% if invalid %}
+        <div class="tab-pane{%if invalid_active%} active{%endif%}" 
id="invalid">
+            <table class="table table-striped">
+                <thead>
+                    <tr>
+                        <th>Username</th>
+                        <th>Project</th>
+                        <th>Reason Invalid</th>
+                    </tr>
+                </thead>
+                <tbody data-bind="foreach: invalid">
+                    <tr>
+                        <td><a data-bind="text: username, attr: {href: link}" 
target="_blank"></a></td>
+                        <td data-bind="text: project"></td>
+                        <td data-bind="text: reason_invalid"></td>
+                    </tr>
+                </tbody>
+            </table>
 
-{% if valid %}
-<h4>Valid Users</h4>
-<table class="table table-striped">
-    <thead>
-        <tr>
-            <th>Username</th>
-            <th>Project</th>
-        </tr>
-    </thead>
-    <tbody data-bind="foreach: valid">
-        <tr>
-            <td><a data-bind="text: username, attr: {href: link}" 
target="_blank"></a></td>
-            <td data-bind="text: project"></td>
-        </tr>
-    </tbody>
-</table>
+            {% include "csv_upload_form.html" %}
+        </div>
+        {% endif %}
+        {% if valid %}
+        <div class="tab-pane{%if valid_active%} active{%endif%}" id="valid">
+            <form action="{{url_for('cohort_upload_finish')}}" method="POST" 
class="form-horizontal finish-upload">
+                <div class="form-actions">
+                    <input type="submit" class="btn btn-primary" value="{% if 
invalid %}Upload Only These Valid Users{% else %}Finish Upload{% endif %}"/>
+                </div>
+            </form>
 
-<form action="{{url_for('cohort_upload_finish')}}" method="POST" 
class="form-horizontal finish-upload">
-    <div class="form-actions">
-        <input type="submit" class="btn btn-primary" value="{% if invalid 
%}Upload Only These Valid Users{% else %}Finish Upload{% endif %}"/>
+            <table class="table table-striped">
+                <thead>
+                    <tr>
+                        <th>Username</th>
+                        <th>Project</th>
+                    </tr>
+                </thead>
+                <tbody data-bind="foreach: valid">
+                    <tr>
+                        <td><a data-bind="text: username, attr: {href: link}" 
target="_blank"></a></td>
+                        <td data-bind="text: project"></td>
+                    </tr>
+                </tbody>
+            </table>
+        </div>
+        {% endif %}
     </div>
-</form>
-{% endif %}
+</div>
 {% endblock %}
 
 

-- 
To view, visit https://gerrit.wikimedia.org/r/75874
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I96af03c73e94623b67302f334519bdc798a2049b
Gerrit-PatchSet: 1
Gerrit-Project: analytics/wikimetrics
Gerrit-Branch: master
Gerrit-Owner: Milimetric <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to