-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create digital resources for the manifests and the canvases, #1438 #1439
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor fixes to make
self.saveSamplingActivityDigitalReference(data.resourceinstance_id); | ||
$.getJSON( arches.urls.api_card + digitalResourcesResourceId ) | ||
.then(function(data) { | ||
console.log(data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove log statement
@@ -240,7 +249,7 @@ define([ | |||
}); | |||
}; | |||
|
|||
this.getThumnail = function(digitalResourceData) { | |||
this.getThumbnail = function(digitalResourceData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!
arches_for_science/models.py
Outdated
try: | ||
statement_tile = Tile.objects.filter(nodegroup_id=statement_nodegroupid, resourceinstance_id=resource_id)[0] | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this except ObjectDoesNotExist?
arches_for_science/models.py
Outdated
manifest_data = instance.manifest | ||
if created: | ||
create_manifest_digitla_resource(manifest_data, instance.transactionid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a type in 'digital'
@receiver(post_save, sender=IIIFManifest) | ||
def create_digital_resources(sender, instance, created, **kwargs): | ||
from arches_for_science.utils.digital_resource_for_manifest import digital_resources_for_manifest, digital_resources_for_canvases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these imports not work from the top of the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The functions are importing the models (from this file). So, I didn't find a way to avoid the circular import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good @njkim. It works great for me in the manifest manager. In the Sample Taking workflow the digital resources are created as expected, but I get the following error when trying to save and continue through the workflow:
digital_resources_for_canvases(instance) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be wrapped in a transaction
@receiver(post_delete, sender=IIIFManifest) | ||
def delete_manifest_x_canvas(sender, instance, **kwargs): | ||
ManifestXCanvas.objects.filter(manifest=instance.manifest["@id"]).delete() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably also good to wrap in a transaction
""" | ||
Creates the digital resources resource instance representing manifest | ||
and also creates the manifest_x_canvas record |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice that you added the doc strings, but we should format them like this: https://peps.python.org/pep-0257/#multi-line-docstrings
""" | ||
the main function to crate/update the digital resource for the manifest | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One line doc strings like this: https://peps.python.org/pep-0257/#one-line-docstrings
Also, create has a small typo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know, thanks.
|
||
def digital_resources_for_canvases(instance): | ||
""" | ||
the main function to crate/update the digital resource for the canvases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo in 'create'
Add receiver to create digital resources resource instances for the manifests and the canvases.
The pr is dependent on archesproject/arches#10261
Three db tables are added:
If manifest is added:
If manifest is deleted:
If canvas is added to a manifest
If canvas is removed from a manifest
Note,