[p2pu-dev] Only challenges come up in Learn page
Jos Flores
josmasflores at gmail.com
Mon Jun 25 12:32:13 UTC 2012
Hey Dirk,
I tracked it down; for some reason the view is tracking a bunch of
supposedly hidden fields in the filters form that do not exist (e.g
archived, closed_signup, and so on). On the closed_signup 'if', it
just goes and filters by CHALLENGE.
I do like chainability but I think there is a lot of cleaning up to be
done before we can think about strategies. I'd like to have a bunch of
tests that will allow refactoring, and that's what I was doing up to
now (instead of working, but don't tell anyone! :D ). Article looks
great but will have to wait for a bit, as it is back to work now.
Would you be happy to pair program for an hour or two some time this
week? we can use team viewer (or a remote tmux session if you are
happy with terminal vim, but team viewer would make sharing easier).
cheers,
Jose
On 25 June 2012 13:05, Dirk Uys <dirk at p2pu.org> wrote:
> Cool, the project view is quite messy. I think most of the filtering happens
> in
> learn(https://github.com/p2pu/lernanta/blob/master/lernanta/apps/projects/views.py#L48)
>
> One thing that we should reduce is the amount of logic in the views. Views
> should have some logic about the flow of interaction, currently we can't
> change a field name in a model without lots of repercussions.
>
> The right way to implement learn would be to write a custom Manager and
> Queryset classes that return a list of projects according to tags. Then the
> view can do something like
>
> Projects.objects.get_project_with_tags(['learn', 'python',
> 'moon']).get_active().get_language('en')
>
> I've read a few articles that describes the above. Here's one:
> http://dabapps.com/blog/higher-level-query-api-django-orm/
>
> This may be overkill, and a simple function taking the QuerySet as a
> parameter and returning a new QuerySet is also good. Then the usage becomes:
>
> tag_filtered = get_projects_with_tags(Project.objects.all, ['list', 'of',
> 'tags'])
> active_projects = get_active_projects(tag_filtered)
> lang_projects = get_language_projects('en')
>
> You loose the chainability, but you skip the boilerplate classes.
>
> Your thoughts?
>
> Cheers
> d
>
>
> On Mon, Jun 25, 2012 at 1:38 PM, Jos Flores <josmasflores at gmail.com> wrote:
>>
>> Trying to track down where the filtering happens... I'm sorry to say
>> this but my head is spinning while reading the projects view/model (I
>> know you didn't write it). A fix that should be two minutes is taking
>> ages cause there are so many side effects that can be triggered, and
>> they all have to be tested :S
>>
>> I'm writing tests and separating stuff around; hope you are OK with that
>> :)
>>
>> cheers,
>> Jose
>>
>>
>> On 25 June 2012 12:29, Dirk Uys <dirk at p2pu.org> wrote:
>> > Hi Jose
>> >
>> > I think that all types of courses should show up. The learning style for
>> > a
>> > course shouldn't affect the listing.
>> >
>> > Thanks!
>> > d
>> >
>> > On Mon, Jun 25, 2012 at 1:20 PM, Jos Flores <josmasflores at gmail.com>
>> > wrote:
>> >>
>> >> Hi guys, is there a reason to show only 'Challenges' in the learn
>> >> page? or is it a 'feature'?
>> >>
>> >> I am working on fixing the tags issue, but although now the count is
>> >> correct, for some reason only challenges are displayed, and that makes
>> >> the numbers wrong again.
>> >>
>> >> cheers,
>> >> Jose
>> >> _______________________________________________
>> >> p2pu-dev mailing list
>> >> p2pu-dev at lists.p2pu.org
>> >> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>> >
>> >
>> >
>> > _______________________________________________
>> > p2pu-dev mailing list
>> > p2pu-dev at lists.p2pu.org
>> > http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>> >
>> _______________________________________________
>> p2pu-dev mailing list
>> p2pu-dev at lists.p2pu.org
>> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>
>
>
> _______________________________________________
> p2pu-dev mailing list
> p2pu-dev at lists.p2pu.org
> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>
More information about the p2pu-dev
mailing list