Skip to content

Commit

Permalink
Fix incorrect query that did not use consider null workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
dojeda committed Feb 28, 2020
1 parent 692e868 commit d73419a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
14 changes: 8 additions & 6 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ This document lists all important changes to Quetzal.

Quetzal version numbers follow `semantic versioning <http://semver.org>`_.

Planned (but not implemented yet):

* Better commit detection with a 3-way merge detection

X.Y.Z (unreleased)
------------------

* Fix incorrect reference on json views, making some family empty contents.
* Fix DB docker image on kubernetes that was missing the logs
* Add verification of existing files before file modification operations
# Fix incorrect common refactoring of global and workspace json views subquery

Planned:

* Better commit detection with a 3-way merge detection

* Fix incorrect common refactoring of global and workspace json views subquery
* Fix incorrect metadata retrieval inside a workspace when there is a new
change on another workspace (it should be irrelevant, but it was incorrectly
used as new metadata)

0.5.0 (2019-10-17)
------------------
Expand Down
2 changes: 1 addition & 1 deletion quetzal/app/api/data/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def commit_workspace(wid):
# Verify conflicts, raise Conflict if there is any conflict
_conflict_detection(workspace)

base_family = workspace.families.filter(Family.name == 'base').first()
base_family = workspace.get_base_family()

# Move new READY files (not temporary and not deleted) to the data
# directory. Since creating a new file creates a new base metadata
Expand Down
13 changes: 3 additions & 10 deletions quetzal/app/api/data/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
from sqlalchemy.exc import IntegrityError

from quetzal.app import db
from quetzal.app.api.data.tasks import init_workspace, init_data_bucket, \
from quetzal.app.api.data.tasks import (
init_workspace, init_data_bucket,
wait_for_workspace, commit_workspace, delete_workspace, scan_workspace
)
from quetzal.app.api.exceptions import APIException, InvalidTransitionException
from quetzal.app.models import Family, User, Workspace, WorkspaceState
from quetzal.app.helpers.celery import log_task
Expand All @@ -24,15 +26,6 @@
FAMILY_NAME_BLACKLIST = ('id', )


# TODO: remove this explanation when werkzeug >=0.15 is released
# NOTE: On several places here, we are using the 412 (precondition failed)
# status code. Flask uses werkzeug to serve the requests. Werkzeug-0.14 has a
# bug where the responses that have this code are sent without body.
# This bug is documented in https://github.com/pallets/werkzeug/issues/1231
# and fixed in the PR https://github.com/pallets/werkzeug/pull/1255
# However, this has not been released yet.


def fetch(*, user):
""" List workspaces
Expand Down
4 changes: 3 additions & 1 deletion quetzal/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,9 @@ def get_latest(file_id, family):
latest_global = (
Metadata
.query
.filter(Metadata.id_file == file_id, Metadata.id <= reference)
.filter(Metadata.id_file == file_id,
Family.fk_workspace_id.is_(None),
Metadata.id <= reference)
.join(Family)
.filter(Family.name == family.name)
.order_by(Metadata.id.desc())
Expand Down

0 comments on commit d73419a

Please sign in to comment.