Skip to content

[SEARCH ENGINE] v 1.0 Districts and Compositions - basic

Ghost User requested to merge development into staging

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 : added composts 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 and result_line CRUD : PASSED
    • result, result_line, compost and userassociations (all the way round) : PASSED
  • In browser
    • rootis the search page : PASSED
    • search page has a form with district input and composition selection : PASSED
    • empty search does not complete, alert is shown : PASSED
    • search by district returns the correct composts (check with console) : PASSED
    • search by composition returns the correct composts (check with console) : PASSED
    • in results show view, relevant info is displayed for every compost : PASSED
    • in resultsshow view, every district or composition_tag is clickable and leads to a new results view displaying relevant composts

Links

Side notes

  • managing old results to avoid useless DB storage ?
  • improving views with helpers and instance method to manage the logic and display prep ?

Merge request reports