Commit 0081057e authored by delanoe's avatar delanoe

[FIX] Donut bug fixed.

parent 6c2db350
...@@ -61,13 +61,13 @@ from django.utils.translation import ugettext_lazy ...@@ -61,13 +61,13 @@ from django.utils.translation import ugettext_lazy
class NewCorpusForm(forms.Form): class NewCorpusForm(forms.Form):
type = forms.ChoiceField( type = forms.ChoiceField(
choices = enumerate(resource_type['name'] for resource_type in RESOURCETYPES), choices = enumerate(resource_type['name'] for resource_type in RESOURCETYPES),
widget = forms.Select(attrs={'onchange':'CustomForSelect( $("option:selected", this).text() );'}) widget = forms.Select(attrs={ 'onchange' :'CustomForSelect( $("option:selected", this).text() );'})
) )
name = forms.CharField( label='Name', max_length=199 , widget=forms.TextInput(attrs={ 'required': 'true' })) name = forms.CharField( label='Name', max_length=199 , widget=forms.TextInput(attrs={ 'required': 'true' }))
file = forms.FileField() file = forms.FileField()
def clean_file(self): def clean_file(self):
file_ = self.cleaned_data.get('file') file_ = self.cleaned_data.get('file')
if len(file_) > 1024 ** 3: # we don't accept more than 1GB if len(file_) > 1024 ** 3 : # we don't accept more than 1GB
raise forms.ValidationError(ugettext_lazy('File too heavy! (>1GB).')) raise forms.ValidationError(ugettext_lazy('File too heavy! (>1GB).'))
return file_ return file_
...@@ -132,9 +132,10 @@ def project(request, project_id): ...@@ -132,9 +132,10 @@ def project(request, project_id):
sourcename2documentscount = defaultdict(int) sourcename2documentscount = defaultdict(int)
for sourcename, corpora in sourcename2corpora.items(): for sourcename, corpora in sourcename2corpora.items():
sourcename = re.sub(' \(.*$', '', sourcename) sourcename = re.sub(' \(.*$', '', sourcename)
count = corpus.children('DOCUMENT').count() for corpus in corpora:
sourcename2documentscount[sourcename] += count count = corpus.children('DOCUMENT').count()
total_documentscount += count sourcename2documentscount[sourcename] += count
total_documentscount += count
donut = [ donut = [
{ 'source': sourcename, { 'source': sourcename,
'count': count, 'count': count,
......
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