Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Tatenda Shangwa](https://uploads.teamtreehouse.com/production/profile-photos/9767212/micro_IMG_20170410_182458_678.jpg)
Tatenda Shangwa
8,710 Pointshow do i set code to ascending order?
Finally, make a variable named sorted_challenges that is all of the Challenge records, ordered by the steps attribute on the model. The order should be ascending, which is the default direction.
HERE IS MY CODE BELOW,sorted challenge variable is giving a error message,where am i going wrong?
from models import Challenge ā all_challenges = Challenge.select() Challenge = Challenge.create(language = "Ruby", name = "Booleans") sorted_challenges = Challenge.order_by(Challenge.steps.asce()).get() ā
from models import Challenge
all_challenges = Challenge.select()
Challenge = Challenge.create(language = "Ruby", name = "Booleans")
sorted_challenges = Challenge.order_by(Challenge.steps.asce()).get()
1 Answer
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,426 PointsYou are close! In Task 3, the create
method does not return anything. By assigning the results of the create back to "Challenge" you overwrite the Challenge
object effectively deleting the imported Class. This can be fixed by removing "Challenge =
" from the code.
In Task 4, the method name should be asc()
not "asce". However, since ascending is the default ordering, the method does not need to be stated.
Finally, the underlying version of peewee may have changed in this challenge. Using the .get()
method on the end of the query, as specified in the video, seems to be fail the challenge. Leaving off the ".get()" passes.
Tagging Craig Dennis to looking into why adding ".get()" after the order_by
method fails in Task 4.