0

Now that the error has been fixed by adding require 'tournament_system' here is my new error:

This is the terminal:

  Rendering html template
  Rendered html template (0.0ms)
  Rendered tourneys/index.html.erb within layouts/application (10.8ms)
Completed 401 Unauthorized in 16ms (Views: 0.3ms | ActiveRecord: 1.1ms)



RuntimeError - Not Implemented:
  app/controllers/tourneys_controller.rb:77:in `tourn'
  app/views/tourneys/index.html.erb:37:in `_app_views_tourneys_index_html_erb__1482772099755741577_70314301318160'

Started POST "/__better_errors/deabb75178ea93ac/variables" for ::1 at 2018-04-17 00:55:03 -0700

This is on the webpage

Not Implemented

tournapp/controllers/tourneys_controller.rb
72
73
74
75
76
77
78
79
80
81
82
  def tourn
    driver = Driver.new
   # Generate a round of a single elimination tournament
    TournamentSystem::SingleElimination.generate driver
    #Challonge::Tournament.find(:all)
    #@teamArray2 = render html: "<div>#{Challonge::Tournament.find(:all)}</div>".html_safe
  end
>>
 This is a live shell. Type in here.
Request info
Request parameters  
{"controller"=>"tourneys", "action"=>"index"}
Rack session    
(object too large. Modify ActionDispatch::Request::Session#inspect or increase BetterErrors.maximum_variable_inspect_size)
Local Variables
driver  
#<Driver:0x00007fe6a4eba5e0>

I believe the error has to do with not calling the driver correctly. Also I created the controller Tourney using a scaffold.

  • Could you share the complete stack trace of the error? – Sinstein Apr 17 '18 at 06:13
  • I am sorry for the dumb question but how do I do that? – Brandon Morales Apr 17 '18 at 06:28
  • When you receive the error, there will be more lines with details about the error and where the error is occurring. It will mostly follow the error message. Sharing that will help pin point the error. – Sinstein Apr 17 '18 at 07:04
  • I edited my post to show the errors. I am hoping this what you are refering to. Thanks for the help. – Brandon Morales Apr 17 '18 at 07:20
  • From what I understand the gem `tournament-system` has been installed but not explicitly required in your `driver.rb`. Try adding `require 'tournament-system'` before `class Driver` and see if that helps. – Sinstein Apr 17 '18 at 07:27
  • ok I did that but now I am getting the error: cannot load such file -- tournament-system – Brandon Morales Apr 17 '18 at 07:30
  • Look at this sample test driver - https://github.com/ozfortress/tournament-system/blob/master/spec/support/test_driver.rb Change the require to `require 'tournament_system'`. That should do it – Sinstein Apr 17 '18 at 07:32
  • Perfect!! However, there is a new error: Not Implemented `def tourn driver = Driver.new # Generate a round of a single elimination tournament TournamentSystem::SingleElimination.generate driver #Challonge::Tournament.find(:all) #@teamArray2 = render html: "
    #{Challonge::Tournament.find(:all)}
    ".html_safe end`
    – Brandon Morales Apr 17 '18 at 07:35
  • I think your `def tournament` has an extra `end` – Sinstein Apr 17 '18 at 07:41
  • I dont think so I just took another look. I believe all the ends are in the right spot and without any extra ones. – Brandon Morales Apr 17 '18 at 07:45
  • You have used `Tourney.all`. Is there a model named `Tourney`? Can you update the question with the new findings and stacktrace? – Sinstein Apr 17 '18 at 07:52
  • I have updated my question. Also yes I do have a model named Tourney but it was created with the scaffold and theres nothing in it. Also the Tourney.All has nothing to really do with the tournament_system part. That was something else I was working on which I got working. – Brandon Morales Apr 17 '18 at 08:00

1 Answers1

0

Your Class Driver was inhereting from TournamentSystem::Driver but that module was not available as it was not explicitly required.

Adding require 'tournament_system' should take care of that.


Regarding the NotImplemented error, this is not related to your code. If you follow the source code of def generate in module SingleElimination (source code) and traverse:

def generate calls create_matches which calls create_match which finally calls build_match and that has a raise 'Not Implemented'.

The Developer of the project has not completed implementing all the required functions.

Sinstein
  • 887
  • 11
  • 42
  • Oh damn I see. So it looks like this gem wont work for my needs since it is not completed. Can you recommend a tutorial or gem that can do single elimination tournaments or any other tournaments besides round robin. As I already got that working with the round-robin gem as you can see in the def tournament section. – Brandon Morales Apr 17 '18 at 08:21
  • Unfortunately I cannot help you there as I have never worked with tournament systems before. You could get in touch with the developer of the project to check if they are going to finish implementing this soon. – Sinstein Apr 17 '18 at 08:24
  • Yea very true. Well thank you for your help. I really appriciate it as I've spent a couple of weeks trying to figure this out. – Brandon Morales Apr 17 '18 at 08:25