Commits

ronald martinez committed e716223

ok

  • Participants
  • Parent commits 8f5ef48

Comments (0)

Files changed (2)

 app.debug = True
 
 
+@app.route('/get_metadata')
+def get_metadata():
+    item = db.metadata.find_one({'id': 1})
+    return jsonify(
+        count_posts=str(item['count_posts']),
+        count_likes=str(item['count_likes']),
+    )
+
 @app.route('/get_percent/<post_id>')
 def get_percent(post_id):
     item = db.progress.find_one(

File templates/index.html

 <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
 <script>
 
+    function get_metadata()
+    {
+        $.getJSON('/get_metadata', function(data) {
+            count_posts = data['count_posts']
+            count_likes = data['count_likes']
+            $("#count_posts").html(count_posts)
+            $("#count_likes").html(count_likes)
+        });
+        setTimeout(get_metadata, 2000);
+    }
+
+
     function add_progress()
     {
         $.getJSON('/progress_bar', function(data) {
         })
     }
 
-    add_progress()
+    //add_progress()
+    get_metadata()
 
 </script>
 </head>
 
 <body>
+
+    <div id="count_posts"></div>
+    <div id="count_likes"></div>
+
     <table id="bar" border="1" width="50%">
         <tr>
             <td>Nro</td>