Detailed Notes
We improve our display of data by using a raw query and pulling in child counts as part of our result set.
You can view source for today and all prior days by reviewing the tag Day 39 at this GitHub: https://github.com/robbroadhead/develpreneur-pythontutorial
Transcript Text
[Music] hello and welcome back we are continuing um skipping ahead around i guess a little bit last time we looked at some css stuff as i was thinking about it you can get deep into that quickly so i'm not going to mess with too much of the css i did do a little bit of playing around and um we'll have that in the in github if you want to see some of this stuff as it kicks into shape uh not all of it's actually getting picked up in my browser right now there's some caching issue and i'm not going to actually dive into it because instead i want to get to a couple of the other functions and one of the things i want to work through is the idea that we've now got these parent-child relationships is to put something to display those a little better starting with road maps so if i go to road maps i go to annual goals i have two time frames underneath that but when i look at my road map i don't know it so what i want to do is i'm going to go in on my roadmaps uh let's see let me see if i can yes i can close that terminal i'm going to shut a couple of these down so i've got a little more to work with because i'm going to want my urls which is here so if i go to roadmap so i've got list roadmaps and create so i want list roadmaps and that's here and when i come through i'm just pulling road map objects right now and what i want to do have we shown okay i don't think we've actually done a raw yet so we're going to take a look at that or if we did let me go over here real quick and see views maybe no we didn't do it there so we may not have covered that let's see did we cover it here no we did some straight up stuff so okay so we're going to go do we're going to look at raw so that's one of the things that we can do here is instead of doing a either all or doing filtered or order by we can actually do a dot raw where we're going to do a full uh i think we're gonna do still new order by name except i'm gonna do that within it where i can actually just send a query back and i'm gonna get it but now i'm gonna need to do something because it's a roadmap i'm gonna need it to be somewhat similar to the roadmap that i had and so what i need to do here is i'm going to select from roadmap i'm going to take a look at my roadmap model so here's what i've got and we're going to do we're going to get a little bit complicated here but i'm going to select my name comma start date comma so i don't think i even i think i used time but i wasn't even doing anything with it um so i'm gonna do uh see time frames which i'm going to actually have to assign that out and minutes from this is whatever the name of this thing is so let's go take a look at this in my sequel real quick i'm gonna do a terminal actually i'm gonna do a big terminal and here just go there for the fun of it if i go to my settings uh where i put my settings here we go it is uh that's my password and the user's root so if i come over here here so my sql dash you root dash p put in my password and now if i see here you can see where this is my dp project so i'm going to use that and then if i show tables and see all the tables and the one i'm going to want is dp project roadmap so let's start with this like star from dp project roadmap and so what i'm going to see is here's my roadmaps now i've got the name which is good i think i'll keep my id so let's put that here i'm going to select id and this is from dp project remember we use the it's the project name underscore the name of the model is the title is the table name uh or you can look at it the way i did so i'm gonna do that and then i want to do order by name so if i take that it's not going to like time frames or minutes so let's see so now what i'm going to do is figure out what what are my time frames and what are my minutes now what i can do there is i actually can go down to my time frames i'm going to teach a little bit of sql here so if i select from time frames and then i'm going to enter join and actually let's do this um well i'm just going to do it this way and i'm going to call him a map i'm going to a molar map at rmp that says good on rmp dot uh id equals this guy called tf i'm gonna keep it star equals tf dot roadmap id so now i'm going to see so i can see all of these and i'm going to see all these tasks i'm sorry all these time frames um so annual personal goals and then um i can see the here the name which is the roadmap so it sort of all sort of blurs together and actually all of these are on the same roadmap which would be easy enough to do so one of the things i want to do with this is now instead of getting anything from the time frame i'm just gonna get my roadmap which goes back to my query here so i want id names and start date so but i have to prefix it with the alias i just used which is that tf uh is it not start date oh i'm sorry not tf it's got to be rmp my mistake because i'm over here uh i i a-list out the roadmap and i want the roadmap information so i'm going to take the roadmap start date roadmap name run map id so if i do that now you see i get just get that same road map all the time so now what i need to do is i can add a groupon group not groupon but group by um i'm gonna group by the rmp.id so now i'm i know that i've got four tasks here so now i'm just gonna get one row but now i need to go get my number of tasks right so i'm going to get so i'm going to do here and i just do count rmp.id and then i get to cast it as i'm going to call that as time frames so now i can see that i've got four time frames and now if i want to add up the minutes uh where's the minutes here which there's probably almost none oh i'd have to go actually into the tasks for those so let's not do that yet but let's go ahead and do and we'll just hard wire it for now so i'm going to zero as minutes and so i get that so i'm going to go ahead and copy and paste that little raw query and although it's not going to give me the same item i have i'm still going to inner join oh i didn't copy and paste that right i don't think oh let's do it this way there we go my mistake and i'm going to take this i don't need the semicolon at the end so i've got this big thing and i've got my uh id name start date time frames so now i need to change my road map list uh where that's at that's up here somewhere so if i go to my roadmap list now besides all this other stuff that i've added yeah see time spent was actually zero but now that's going to be [Music] item.minutes because i'm passing that back and uh let's see i'm gonna say has and this is gonna be item.time frames children so now it's got a certain number of children and let's just look at it that way so i save that and now i see that i've got annual goals that one has four children now you can see i lost my other one there so what i need to do is fix my query because i have an inner join that means only bring back the ones the tasks where there's a parent so instead i'm not going to make an inner join i'm going to do a left join actually yeah i'll say left join so if i do that and let's look at that query real quick if we do that one what we're going to see over here whoops i need semicolon is it's getting all of those so it's grabbing oh because it's going by tasks which is a bit of so we need to reverse it uh here we go so here we're doing it from time frames but we actually need to do it from the road map and we're going to join it on the time frames and see what happens oop hey my semicolon and so now i see that i've got one time frame because it only counts at once and so i really need to count the time frame id which is uh easy enough to do so here instead of counting the rnp id i'm going to count the time frame id right and as we come over here let's get this semicolon and now we see that i get that and so now if i go to my app i see that i've got this and i've got my children so we've been able to take that parent child into our interface and that's the next thing we're going to do is we're going to step down to the next level and start looking at sub time frames and also time time elapsed or spent on something based on its task on a time frame based on its tasks because once we get down to a task then or to a time frame then we have tasks and we're going to be able to work with those and we're going to do a little cleaning up here as well because i'm not being able to see my last item on there so that'll be our next steps going to continue digging into this making this a little easier to deal with and be able to see more useful information we go through it and then start actually walking through the application and do sort of a user acceptance test and build out some tasks so that's some stuff to look forward to as always hope you go out there and have yourself a great day and we will talk to you oh by the way this is i believe now episode 38 that we are working on um maybe a little further up that means let me check that real quick so this is actually 39 this will be day 39 if you're following along in github take a look at the day 39 tag and you'll be able to see the code that's here and take it moving forward from there so once again have some great day we will talk to you next time you
Transcript Segments
[Music]
hello
and welcome back we are continuing
um skipping ahead around i guess a
little bit last time we looked at some
css stuff
as i was thinking about it you can get
deep into that quickly
so i'm not going to mess with too much
of the css
i did do a little bit of playing around
and um
we'll have that in the in github if you
want to
see some of this stuff as it kicks into
shape
uh not all of it's actually getting
picked up in my browser right now
there's some caching issue
and i'm not going to actually dive into
it because instead
i want to get to a couple of the other
functions
and one of the things i want to work
through is the idea that we've now got
these
parent-child relationships is to put
something to display those a little
better
starting with road maps so if i go to
road maps i go to annual goals
i have two time frames underneath that
but when i look at my road map
i don't know it so what i want to do is
i'm going to go in
on my roadmaps uh let's see
let me see if i can yes i can close that
terminal i'm going to shut a couple of
these down
so i've got a little more to work with
because i'm going to want my urls which
is here so if i go to roadmap
so i've got list roadmaps and create so
i want list roadmaps
and that's here and when i come through
i'm just pulling road map objects right
now
and what i want to do have we shown
okay i don't think we've actually done a
raw yet so we're going to take a look at
that
or if we did
let me go over here real quick and see
views maybe
no we didn't do it there
so we may not have covered that let's
see did we cover it here
no we did some straight up stuff so okay
so we're going to go do we're going to
look at raw so that's one of the things
that we can do here is instead of
doing a
either all or doing filtered or order by
we can actually do
a dot raw where we're going to do
a full uh i think we're gonna do still
new order by name
except i'm gonna do that within it where
i can actually just send a query back
and i'm gonna get it
but now i'm gonna need to do something
because it's a roadmap
i'm gonna need it to be somewhat similar
to
the roadmap that i had and so what i
need to do here
is i'm going to select from roadmap
i'm going to take a look at my roadmap
model
so here's what i've got
and we're going to do we're going to get
a little bit complicated here but i'm
going to select my name
comma start date
comma so i don't think i even i think i
used time but i wasn't even doing
anything
with it um so i'm gonna do
uh see time frames
which i'm going to actually have to
assign that out
and minutes
from this is
whatever the name of this thing is so
let's go take a look at this in my
sequel real quick i'm gonna do a
terminal
actually i'm gonna do a big terminal
and here
just go there for the fun of it if i go
to my settings
uh where i put my settings here we go
it is uh that's my password
and the user's root
so if i come over here
here so my sql dash you
root dash p
put in my password and now if i see
here you can see where this
is my dp project so i'm going to use
that
and then if i show tables and see all
the tables and the one i'm going to want
is dp project roadmap so let's start
with this
like star
from dp project roadmap and so what i'm
going to see is here's my roadmaps
now i've got the name which is good i
think i'll keep my id so let's put that
here i'm going to select id
and this is from dp project remember we
use the
it's the project name underscore the
name of the model
is the title is the table name uh or you
can look at it the way i did so i'm
gonna do that and then i want to do
order by name
so if i take that it's not going to like
time frames or minutes
so
let's see
so now what i'm going to do is figure
out what what are my time frames and
what are my minutes
now what i can do there is
i actually can go down to my time frames
i'm going to teach a little bit of sql
here
so if i select from time frames and then
i'm going to enter join
and actually let's do this um
well i'm just going to do it this way
and i'm going to call him a map i'm
going to a molar map
at rmp that says good on rmp dot
uh id equals
this guy
called tf i'm gonna keep it star
equals tf dot roadmap id
so now i'm going to see so i can see all
of these and i'm going to
see all these tasks i'm sorry all these
time frames
um so annual personal goals
and then um i can see the
here the name which is the roadmap so it
sort of all sort of blurs together and
actually all of these are on the same
roadmap
which would be easy enough to do so one
of the things i want to do
with this is now
instead of getting anything from the
time frame i'm just gonna get my roadmap
which goes back to
my query here so i want
id names and start date
so but i have to prefix it with the
alias i just used
which is that tf
uh is it not start date
oh i'm sorry not tf it's got to be rmp
my mistake because i'm over here
uh i i a-list out the roadmap
and i want the roadmap information so
i'm going to take the roadmap start date
roadmap name run map id
so if i do that now you see i get just
get that same road map all the time so
now what i need to do
is i can add a groupon group
not groupon but group by um
i'm gonna group by the rmp.id
so now i'm i know that i've got four
tasks here
so now i'm just gonna get one row but
now i need to go get my number of tasks
right so i'm going to get
so i'm going to do here and i just do
count
rmp.id and then i get to cast it as
i'm going to call that as time frames
so now i can see that i've got four time
frames and now if i want to add up the
minutes uh where's the minutes here
which there's probably almost
none oh i'd have to go actually into the
tasks for those so
let's not do that yet
but let's go ahead
and do
and we'll just hard wire it for now so
i'm going to zero as minutes
and so i get that so i'm going to go
ahead and copy and paste
that little raw query
and although it's not going to give me
the same item i have
i'm still going to inner join
oh i didn't copy and paste that right i
don't think
oh let's do it this way there we go
my mistake and i'm going to take this
i don't need the semicolon at the end so
i've got this big thing and i've got my
uh
id name start date time frames so now
i need to change my road map list
uh where that's at that's up here
somewhere so if i go to my roadmap list
now besides all this other stuff that
i've added
yeah see time spent was actually zero
but now that's going to be
[Music]
item.minutes because i'm passing that
back
and uh let's see
i'm gonna say has
and this is gonna be item.time frames
children so now it's got a certain
number of children
and let's just look at it that way so i
save that
and now i see that i've got annual goals
that one has
four children now you can see i
lost my other one there so what i need
to do
is fix my query because
i have an inner join that means only
bring back the ones
the tasks where there's a parent so
instead
i'm not going to make an inner join i'm
going to do a left join actually
yeah i'll say left join
so if i do that and let's look at that
query real quick
if we do that one what we're going to
see over here
whoops i need semicolon is it's getting
all of those so it's grabbing oh because
it's going by tasks
which is a bit of so we need to reverse
it
uh here we go
so here we're doing it from time frames
but we actually need to do it
from the road map
and we're going to join it
on the time frames
and see what happens
oop hey my semicolon and so now i see
that i've got one time frame
because it only counts at once
and so i really need to count the time
frame id
which is uh easy enough to do
so here instead of counting the rnp id
i'm going to count the time frame id
right
and as we come over here let's get this
semicolon and now we see that i get that
and so now if i go to my app
i see that i've got this and i've got my
children so we've been able to
take that parent child into our
interface and that's the next thing
we're going to do is we're going to step
down to the next level
and start looking at sub time frames
and also time time
elapsed or spent on something based on
its task on a time frame based on its
tasks
because once we get down to a task then
or to a time frame then we have tasks
and we're going to be able to work with
those and we're going to do a little
cleaning up here as well because
i'm not being able to see my last item
on there so that'll be our next steps
going to continue digging into this
making this a little easier to deal with
and be able to see more useful
information we go through it and then
start actually walking through the
application and do sort of a
user acceptance test and build out some
tasks so
that's some stuff to look forward to as
always hope you go out there and have
yourself a great day
and we will talk to you oh by the way
this is i believe now
episode 38 that we are
working on um maybe a little further up
that means
let me check that real quick
so this is actually 39 this will be day
39
if you're following along in github take
a look at the
day 39 tag and you'll be able to see the
code that's
here and take it moving forward from
there so
once again have some great day we will
talk to you
next time
you