Skip to content

Commit

Permalink
Add update default info
Browse files Browse the repository at this point in the history
  • Loading branch information
extensionsapp committed Jan 4, 2018
1 parent 5d60135 commit 77595af
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
59 changes: 59 additions & 0 deletions config/update/update_info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use strict';

/**
* Module dependencies.
*/

var CP_save = require('../../lib/CP_save.min');
var CP_get = require('../../lib/CP_get.min');

/**
* Node dependencies.
*/

var async = require('async');

(function upd(i) {

i = i || 1;
var ii = i+1;

if (i >= 300) {
return;
}

CP_get.movies(
{"certainly": true},
10000,
'',
i,
false,
function (err, movies) {
if (err) {
console.log(err);
return;
}

if (movies && movies.length) {
async.eachOfLimit(movies, 1, function (movie, key, callback) {
delete movie.year;
delete movie.premiere;
delete movie.kp_rating;
delete movie.kp_vote;
delete movie.imdb_rating;
delete movie.imdb_vote;
movie.id = movie.kp_id;
CP_save.save(
movie,
'rt',
function (err, result) {
return callback(err);
});
}, function (err) {
console.log(err);
upd(ii);
});
}
});

})();
4 changes: 2 additions & 2 deletions themes/default/views/admin/display.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
</a>
</div>
<select name="config.default.votes.imdb" class="form-control">
<% for (var i = 100; i <= 10000; i = i+100) { %>
<% for (var i = 0; i <= 10000; i = i+100) { %>
<% if (config.default.votes.imdb == i) { %>
<option value="<%= i %>" selected="selected">
<%- i %> голос(-ов)
Expand All @@ -222,7 +222,7 @@
</a>
</div>
<select name="config.default.votes.kp" class="form-control">
<% for (var i = 100; i <= 10000; i = i+100) { %>
<% for (var i = 0; i <= 10000; i = i+100) { %>
<% if (config.default.votes.kp == i) { %>
<option value="<%= i %>" selected="selected">
<%- i %> голос(-ов)
Expand Down

0 comments on commit 77595af

Please sign in to comment.