GithubHelp home page GithubHelp logo

Comments (7)

michaelfahy avatar michaelfahy commented on August 30, 2024

Looks like this issue has been addressed in the closed issue "create_student_teams fails due to GitHub API change" but id still does not work!

from teachers_pet.

tarebyte avatar tarebyte commented on August 30, 2024

@michaelfahy

I can take a look at this later tonight, can you give the full error and possibly the snippet of your file that failed?

Thanks!

from teachers_pet.

afeld avatar afeld commented on August 30, 2024

@michaelfahy What version of teachers_pet do you have? You can run gem list -d teachers_pet to find out, then gem update teachers_pet to get the latest (0.3.5). Let us know if that works!

For reference, the issue referred to above is #88.

from teachers_pet.

michaelfahy avatar michaelfahy commented on August 30, 2024

I am using teachers_pet 0.3.5.
My students file is a list of student github IDs. They already belong to a team named "students" in the organization. The create_student_teams commands authenticates to GitHub, reads the ids from the students file and successfully creates a team for the first student on the list but then displays this error and stops:
/usr/local/rvm/gems/ruby-2.2.0/gems/json-1.8.2/lib/json/common.rb:155:in initialize': can't convert Sawyer::Resource to String (Sawyer::Resource#to_str gives NilClass) (TypeError) from /usr/local/rvm/gems/ruby-2.2.0/gems/json-1.8.2/lib/json/common.rb:155:innew'
from /usr/local/rvm/gems/ruby-2.2.0/gems/json-1.8.2/lib/json/common.rb:155:in parse' from /home/michael/teachers_pet/lib/teachers_pet/actions/create_student_teams.rb:24:inblock in create_student_teams'
from /home/michael/teachers_pet/lib/teachers_pet/actions/create_student_teams.rb:9:in each' from /home/michael/teachers_pet/lib/teachers_pet/actions/create_student_teams.rb:9:increate_student_teams'
from /home/michael/teachers_pet/lib/teachers_pet/actions/create_student_teams.rb:33:in run' from /home/michael/teachers_pet/lib/teachers_pet/commands/create_student_teams.rb:10:increate_student_teams'
from /usr/local/rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in run' from /usr/local/rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:ininvoke_command'
from /usr/local/rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in dispatch' from /usr/local/rvm/gems/ruby-2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:instart'
from ./bin/teachers_pet:4:in `

'

from teachers_pet.

aronwc avatar aronwc commented on August 30, 2024

@michaelfahy any luck with this? I have the same problem.

It looks like the create_student_teams method tries to parse the result of client.create_team as a JSON object, but it returns something like this instead: <Sawyer::Resource:0x007f7f65374777>

from teachers_pet.

aronwc avatar aronwc commented on August 30, 2024

BTW, here is my workaround

--- a/lib/teachers_pet/actions/create_student_teams.rb
+++ b/lib/teachers_pet/actions/create_student_teams.rb
@@ -21,8 +21,9 @@ module TeachersPet
           if team
             puts "Team @#{org_login}/#{team_name} already exists."
           else
-            team = JSON.parse(self.client.create_team(org_login, team_name))
-            team.symbolize_keys!
+            res = self.client.create_team(org_login, team_name)
+            teams_by_name = self.client.existing_teams_by_name(org_login)
+            team = teams_by_name[team_name]
           end
           self.client.add_users_to_team(org_login, team, usernames)
         end

It makes extra calls to the GH API to get the new team ids, since they doesn't seem to be returned by the create_team call.

from teachers_pet.

erikmd avatar erikmd commented on August 30, 2024

Dear maintainers of teachers_pet,
I was also faced with this issue yesterday, and @aronwc 's workaround worked like a charm.
Could this fix be directly integrated in master? or should I open a PR?
Best regards.

from teachers_pet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.