Commit ffff2fd6 authored by Administrator's avatar Administrator

[FEAT] no link for Graph page if Workflow not finished yet.

parent bd4666e6
...@@ -496,11 +496,17 @@ def corpus(request, project_id, corpus_id): ...@@ -496,11 +496,17 @@ def corpus(request, project_id, corpus_id):
except Exception as error: except Exception as error:
print(error) print(error)
try:
processing = corpus.metadata['Processing']
except:
processing = 0
html = t.render(Context({\ html = t.render(Context({\
'user': user,\ 'user': user,\
'date': date,\ 'date': date,\
'project': project,\ 'project': project,\
'corpus' : corpus,\ 'corpus' : corpus,\
'processing' : processing,\
# 'documents': documents,\ # 'documents': documents,\
'number' : number,\ 'number' : number,\
'dates' : chart,\ 'dates' : chart,\
......
...@@ -237,12 +237,16 @@ class Node(CTENode): ...@@ -237,12 +237,16 @@ class Node(CTENode):
@current_app.task(filter=task_method) @current_app.task(filter=task_method)
def workflow(self, keys=None, ngramsextractorscache=None, ngramscaches=None, verbose=False): def workflow(self, keys=None, ngramsextractorscache=None, ngramscaches=None, verbose=False):
print("In workflow() START") print("In workflow() START")
self.metadata['Processing'] = 1
self.save()
self.parse_resources() self.parse_resources()
type_document = NodeType.objects.get(name='Document') type_document = NodeType.objects.get(name='Document')
self.children.filter(type_id=type_document.pk).extract_ngrams(keys=['title',]) self.children.filter(type_id=type_document.pk).extract_ngrams(keys=['title',])
from analysis.functions import do_tfidf from analysis.functions import do_tfidf
do_tfidf(self) do_tfidf(self)
print("In workflow() END") print("In workflow() END")
self.metadata['Processing'] = 0
self.save()
class Node_Metadata(models.Model): class Node_Metadata(models.Model):
node = models.ForeignKey(Node, on_delete=models.CASCADE) node = models.ForeignKey(Node, on_delete=models.CASCADE)
......
...@@ -131,7 +131,11 @@ ...@@ -131,7 +131,11 @@
<div class="col-md-4"> <div class="col-md-4">
<div class="jumbotron"> <div class="jumbotron">
{% if processing == "0" %}
<h3><a href="/project/{{project.id}}/corpus/{{ corpus.id }}/explorer">Graph</a></h3> <h3><a href="/project/{{project.id}}/corpus/{{ corpus.id }}/explorer">Graph</a></h3>
{% else %}
<h3> <img width="20px" src="{% static "js/libs/img2/loading-bar.gif" %}"></img> Graph (later)</h3>
{% endif %}
<ol> <ol>
<li>Visualize</li> <li>Visualize</li>
<li>Explore</li> <li>Explore</li>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment