The project count logic is going to be really slow if a site has hundreds, thousands, or more projects. Unfortunately it is the correct logic so we can't really change it to make it faster. The options I can think of are:
don't do a project count at all
control it with a config setting, or better yet if the total M.Project.query.count() is bigger than some threshold, then skip the counts
cache the count values - but this doesn't really work with permissions since different people can see different projects
Instead of having inline CSS the width & height for .placeholder could be in the CSS file.
Should have </div> not </tbody>
If a neighborhood name is long, you can't see the project count, and sometimes the name itself can be cut off. Maybe we don't want a fixed size for the boxes.
Looks better than the previous :D
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
control it with a config setting, or better yet if the total M.Project.query.count() is bigger than some threshold, then skip the counts
I chose to add a threshold of 100 so it will appear as 100+ Projects. For testing I set it to 10.
If a neighborhood name is long, you can't see the project count, and sometimes the name itself can be cut off. Maybe we don't want a fixed size for the boxes.
Removed the grid-4 and instead added a min-width
Instead of having inline CSS the width & height for .placeholder could be in the CSS file.
Should have not
Fixed :)
Last edit: Rohan Verma 2016-08-03
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The project count logic is going to be really slow if a site has hundreds, thousands, or more projects. Unfortunately it is the correct logic so we can't really change it to make it faster. The options I can think of are:
M.Project.query.count()
is bigger than some threshold, then skip the countsInstead of having inline CSS the width & height for
.placeholder
could be in the CSS file.Should have
</div>
not</tbody>
If a neighborhood name is long, you can't see the project count, and sometimes the name itself can be cut off. Maybe we don't want a fixed size for the boxes.
Looks better than the previous :D
I chose to add a threshold of 100 so it will appear as 100+ Projects. For testing I set it to 10.
Removed the grid-4 and instead added a min-width
Fixed :)
Last edit: Rohan Verma 2016-08-03
projects_count()
gets called twice. Can set it to a variable in the template. Or make it a@LazyProperty
(that will have it cache its result)It'll probably never run for anyone, but the "else" part that has
<tr><td class="no-nbhds">
should be a div or something, since the table is gone.Looks good otherwise.
Updated! :)