[SEARCH ENGINE] v 1.0 Districts and Compositions - basic
Goals
Enable compost search based on their district tag
- User should be able to input a district and get the list of all composts in that district
- User should be able to navigate to the returned composts
Enable compost search based on their composition tags
- User should be able to choose composition tag(s) and the the list of all composts that have these tags
- User should be able to navigate to the returned composts
Enable mixed search
- User should be able to specify the district AND one or several tag(s) and get the list of all compost that meet both criterias
Lesser features
- User should not be able to do an empty search
- While browsing the results list, user should be able to click on a criteria to get all the composts satisfying this criteria
Changes
-
app/controllers/results_controller.rb
: added logic for results creation -
app/models/{compost.rb,contribution.rb,result_line.rb, result.rb, user.rb}
: added associations to the models -
app/models/result.rb
: added logic for result generation -
app/views/results/_form.html.erb
: added form inputs and logic to trigger the search -
app/views/results/show.html.erb
: addedcomposts
display with links -
config/routes.rb
: root set to search page -
db/migrate/...{create_results,create_result_lines}
: attributes and associations -
db/schema.rb
: updated via migrations
Tests
- In
$ rails console
:-
result
andresult_line
CRUD : PASSED -
result
,result_line
,compost
anduser
associations (all the way round) : PASSED
-
- In browser
-
root
is the search page : PASSED -
search page has a form with district
input andcomposition
selection : PASSED -
empty search does not complete, alert is shown : PASSED -
search by district
returns the correctcomposts
(check with console) : PASSED -
search by composition
returns the correctcomposts
(check with console) : PASSED -
in results
show view, relevant info is displayed for everycompost
: PASSED -
in results
show view, everydistrict
orcomposition_tag
is clickable and leads to a newresults
view displaying relevantcomposts
-
Links
- Trello : Recherche par tag
- Search page
- Tagging system wiki
- gem's doc
- Save array in PGSQL DB
- Send checkboxes input as an array
Side notes
- managing old results to avoid useless DB storage ?
- improving
views
with helpers and instance method to manage the logic and display prep ?