Compare commits

..

No commits in common. "4e92d717d524c30ff96838a50071652a63395a88" and "f3638d918d79a3d4d7eb932577519b572dd3f897" have entirely different histories.

4 changed files with 11 additions and 18 deletions

View File

@ -19,10 +19,7 @@ def delete(user, id):
def get(user, id):
db = database.get_db()
obj = db.objects.find_one(ObjectId(id))
if not obj:
raise util.errors.NotFound('Object not found')
return obj
return db.objects.find_one(ObjectId(id))
def copy_to_project(user, id, project_id):
db = database.get_db()

View File

@ -227,7 +227,7 @@ const mapStateToProps = (state, ownProps) => {
return aDate < bDate;
});
const user = state.users.users.filter(u => state.auth.currentUserId === u._id)[0];
const myProjects = state.projects.projects.filter(p => p.owner?.username === user?.username);
const myProjects = state.projects.projects.filter(p => p.owner && p.owner.username === user.username);
return { user, myProjects, project, objects, fullProjectPath: `${username}/${projectPath}`, object, comments };
};
const mapDispatchToProps = dispatch => ({

View File

@ -59,7 +59,6 @@ class DraftPreview extends Component {
const weftColourwayCanvas = document.querySelector(`.preview-${id} .weft-colourway`);
const drawdownCanvas = document.querySelector(`.preview-${id} .drawdown`);
const tieupsCanvas = document.querySelector(`.preview-${id} .tieups`);
if (warpCanvas) {
ctx.drawImage(warpColourwayCanvas, canvas.width - warpCanvas.width - weft.treadles * baseSize - 20, 0);
ctx.drawImage(warpCanvas, canvas.width - warpCanvas.width - weft.treadles * baseSize - 20, 10);
ctx.drawImage(weftCanvas, canvas.width - 10 - weft.treadles * baseSize, warp.shafts * baseSize + 20);
@ -68,7 +67,6 @@ class DraftPreview extends Component {
ctx.drawImage(drawdownCanvas, canvas.width - drawdownCanvas.width - weft.treadles * baseSize - 20, warp.shafts * baseSize + 20);
this.props.onImageLoaded(canvas.toDataURL());
}
}, 500);
}

View File

@ -36,10 +36,8 @@ class Tieups extends Component {
const tieups = Object.assign([], this.props.tieups);
if (tieup >= tieups.length) this.fillUpTo(tieups, tieup);
if (tieups[tieup] !== undefined) {
if (tieups[tieup].indexOf(shaft) === -1) tieups[tieup].push(shaft);
if (tieups[tieup] && tieups[tieup].indexOf(shaft) === -1) tieups[tieup].push(shaft);
else tieups[tieup].splice(tieups[tieup].indexOf(shaft));
}
this.props.updatePattern({ tieups });
}