mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 02:44:18 +00:00
Add sanity checks for corpus preparation
This commit is contained in:
parent
910a187c04
commit
04fe6b063e
@ -85,9 +85,12 @@ def prepare_corpus(corpus_id):
|
|||||||
corpus = Corpus.query.get_or_404(corpus_id)
|
corpus = Corpus.query.get_or_404(corpus_id)
|
||||||
if not (corpus.creator == current_user or current_user.is_administrator()):
|
if not (corpus.creator == current_user or current_user.is_administrator()):
|
||||||
abort(403)
|
abort(403)
|
||||||
corpus.status = 'preparable'
|
if len(corpus.files.all()) > 0:
|
||||||
db.session.commit()
|
corpus.status = 'preparable'
|
||||||
flash('Corpus marked for preparation!')
|
db.session.commit()
|
||||||
|
flash('Corpus marked for preparation!')
|
||||||
|
else:
|
||||||
|
flash('Can not prepare corpus, please add corpus file(s).')
|
||||||
return redirect(url_for('corpora.corpus', corpus_id=corpus_id))
|
return redirect(url_for('corpora.corpus', corpus_id=corpus_id))
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,9 @@
|
|||||||
{% if corpus.status == 'prepared' %}
|
{% if corpus.status == 'prepared' %}
|
||||||
<a href="{{ url_for('corpora.corpus_analysis', corpus_id=corpus.id) }}" class="waves-effect waves-light btn"><i class="material-icons left">help</i>Analyse</a>
|
<a href="{{ url_for('corpora.corpus_analysis', corpus_id=corpus.id) }}" class="waves-effect waves-light btn"><i class="material-icons left">help</i>Analyse</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if corpus.files[0] is defined %}
|
||||||
<a href="{{ url_for('corpora.prepare_corpus', corpus_id=corpus.id) }}" class="waves-effect waves-light btn"><i class="material-icons left">whatshot</i>Prepare</a>
|
<a href="{{ url_for('corpora.prepare_corpus', corpus_id=corpus.id) }}" class="waves-effect waves-light btn"><i class="material-icons left">whatshot</i>Prepare</a>
|
||||||
|
{% endif %}
|
||||||
<a data-target="delete-corpus-modal" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete Corpus</a>
|
<a data-target="delete-corpus-modal" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete Corpus</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user