Skip to content

Commit

Permalink
Merge pull request #339 from gitnnolabs/refactory
Browse files Browse the repository at this point in the history
Nova lista de universo e na lista de objetos e ano aleatório para os repositórios
  • Loading branch information
gitnnolabs authored Aug 29, 2024
2 parents b92fa9a + 6947522 commit 595f108
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions education_directory/search_indexes.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# coding: utf-8
import random
from haystack import indexes
from django.conf import settings
from django.utils.translation import gettext as _


from education_directory import models


Expand Down Expand Up @@ -59,6 +61,9 @@ def prepare_year(self, obj):

if obj.end_date:
return obj.end_date.year

if not obj.end_date and not obj.start_date:
return random.randint(2014, 2023)

def prepare_created(self, obj):
return obj.created.isoformat()
Expand Down
4 changes: 4 additions & 0 deletions event_directory/search_indexes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# coding: utf-8
import random
from haystack import indexes
from django.conf import settings
from django.utils.translation import gettext as _
Expand Down Expand Up @@ -60,6 +61,9 @@ def prepare_year(self, obj):

if obj.end_date:
return obj.end_date.year

if not obj.end_date and not obj.start_date:
return random.randint(2014, 2023)

def prepare_created(self, obj):
return obj.created.isoformat()
Expand Down
5 changes: 5 additions & 0 deletions infrastructure_directory/search_indexes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# coding: utf-8
import random
from haystack import indexes
from django.conf import settings
from django.utils.translation import gettext as _
Expand Down Expand Up @@ -29,6 +30,7 @@ class InfraStructureIndex(indexes.SearchIndex, indexes.Indexable):
states = indexes.MultiValueField(null=True)
regions = indexes.MultiValueField(null=True)
thematic_level_0 = indexes.MultiValueField(null=True)
year = indexes.CharField(null=True)

text = indexes.CharField(document=True, use_template=True)
title = indexes.CharField(model_attr="title", null=True)
Expand All @@ -55,6 +57,9 @@ class InfraStructureIndex(indexes.SearchIndex, indexes.Indexable):
creator = indexes.CharField(null=False)
updated_by = indexes.CharField(null=False)

def prepare_year(self, obj):
return random.randint(2014, 2023)

def prepare_created(self, obj):
return obj.created.isoformat()

Expand Down
4 changes: 4 additions & 0 deletions policy_directory/search_indexes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# coding: utf-8
import random
from haystack import indexes
from django.conf import settings
from django.utils.translation import gettext as _
Expand Down Expand Up @@ -51,6 +52,9 @@ class PolicyIndex(indexes.SearchIndex, indexes.Indexable):
def prepare_year(self, obj):
if obj.date:
return obj.date.year
else:
return random.randint(2014, 2023)


def prepare_created(self, obj):
return obj.created.isoformat()
Expand Down
3 changes: 3 additions & 0 deletions search/templates/graph/graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ <h1 class="mb-1">Indicadores</h1>
<select id="universe" class="chzn-select ordem form-control">
<option value="brazil" selected="">Brasil</option>
<option value="brazil_region">Brasil - Região</option>
<option value="brazil_posgraduate">Brasil - Pós Graduação</option>
<option value="brazil_state">Brasil - Estado</option>
<option value="brazil_instituion">Brasil - Instituição</option>
<option value="world">Mundo</option>
Expand Down Expand Up @@ -189,6 +190,8 @@ <h1 class="mb-1">Indicadores</h1>
<option value="{{ type.0 }}">{{ type.0|translate_data }}
</option>
{% endfor %}
<option value="all">Arquivo de Dados</option>
<option value="all">Preprints</option>
</select>

<select id="classification" name="classification" class="chzn-select ordem form-control"
Expand Down

0 comments on commit 595f108

Please sign in to comment.