compress last move string in db
parent
4d920e2ac6
commit
207494e905
|
@ -147,7 +147,7 @@ case class DbGame(
|
|||
turns = game.turns,
|
||||
positionHashes = history.positionHashes mkString,
|
||||
castles = history.castleNotation,
|
||||
lastMove = history.lastMove map { case (a, b) ⇒ a + " " + b },
|
||||
lastMove = history.lastMove map { case (a, b) ⇒ a + b },
|
||||
status =
|
||||
if (situation.checkMate) Status.Mate
|
||||
else if (situation.staleMate) Status.Stalemate
|
||||
|
|
|
@ -7,7 +7,7 @@ import play.api.templates.Html
|
|||
|
||||
trait AssetHelper {
|
||||
|
||||
val assetVersion = 96
|
||||
val assetVersion = 97
|
||||
|
||||
def cssTag(name: String) = css("stylesheets/" + name)
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ function cleanOrRename(arr, from, to) {
|
|||
rename(arr, from, to);
|
||||
}
|
||||
|
||||
function compactPs(ps) { return ps.replace(/ /g, ''); }
|
||||
function removeSpace(str) { return str.replace(/ /g, ''); }
|
||||
|
||||
function finishedOrAborted(game) { return game.status >= 25; }
|
||||
|
||||
|
@ -57,6 +57,7 @@ gamesToMigrate.forEach(function(g) {
|
|||
}
|
||||
cleanOrRename(g, 'check', 'ck');
|
||||
cleanOrRename(g, 'lastMove', 'lm');
|
||||
map(g, 'lm', removeSpace);
|
||||
cleanOrRename(g, 'initialFen', 'if');
|
||||
clean(g, 'clock');
|
||||
cleanArray(g, 'userIds');
|
||||
|
@ -95,7 +96,7 @@ gamesToMigrate.forEach(function(g) {
|
|||
rename(g, 'players', 'p');
|
||||
g.p.forEach(function(p) {
|
||||
delete p.c;
|
||||
map(p, 'ps', compactPs);
|
||||
map(p, 'ps', removeSpace);
|
||||
if (finishedOrAborted(g) && typeof p.blurs !== 'undefined' && p.blurs < 7) {
|
||||
delete p.blurs;
|
||||
} else {
|
||||
|
@ -113,7 +114,7 @@ gamesToMigrate.forEach(function(g) {
|
|||
delete g.pgn;
|
||||
collection.insert(g);
|
||||
if (pgn !== null && pgn !== "") {
|
||||
pgnCollection.insert({_id: g.id, p: pgn});
|
||||
pgnCollection.insert({_id: g._id, p: pgn});
|
||||
}
|
||||
++it;
|
||||
if (it % batchSize == 0) {
|
||||
|
|
|
@ -11,7 +11,7 @@ $(function() {
|
|||
var letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
|
||||
var fen = $this.data('fen').replace(/\//g, '');
|
||||
var lm = $this.data('lastmove');
|
||||
var lastMove = lm ? lm.split(' ') : [];
|
||||
var lastMove = lm ? [lm[0] + lm[1], lm[2] + lm[3]] : [];
|
||||
var x, y, html = '', scolor, pcolor, pclass, c, d, increment;
|
||||
var pclasses = {'p':'pawn', 'r':'rook', 'n':'knight', 'b':'bishop', 'q':'queen', 'k':'king'};
|
||||
var pregex = /(p|r|n|b|q|k)/;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit ac736ec13b393d1ceb01886a1f5f83c6bfb1c246
|
||||
Subproject commit 08cc96393033954d4ce0d1cc421de6ab9cb22122
|
Loading…
Reference in New Issue