Skip to content
This repository has been archived by the owner on Jun 1, 2019. It is now read-only.

users first, not releases #44

Open
tarekziade opened this issue Jan 26, 2017 · 7 comments
Open

users first, not releases #44

tarekziade opened this issue Jan 26, 2017 · 7 comments

Comments

@tarekziade
Copy link

This is a really cool idea!

My first reaction when I browsed the page though was : too bad I have to browse within versions to get people names. It's obfuscating the main info: thanking people, not version numbers

What if the main view was a single list of names ? and for each one a list of version.

e.g.:

  • John Doe (1.2.3, etc.)

My 2 cents

@steveklabnik
Copy link
Member

Yeah, I'm not 100% sure what should be on the home page, but a view like this, sort of the reverse of the "all time" page, would be good regardless of where it goes!

@steveklabnik
Copy link
Member

I need someone who's good at sql here; I have a branch with all of the work done except the query.

hear my prayers, oh based @sgrif 😜

@sgrif
Copy link
Contributor

sgrif commented Mar 19, 2017

let users = ...;
let commits = Commit::belonging_to(&users).grouped_by(&users);
let users_and_commits = users.into_iter().zip(commits);
let releases = releases.load::<Release>.into_iter()
    .map(|release| (release.id, release)).collect::<HashMap<_, _>>;

users_and_commits.map(|(user, commits)| {
    let release_names = commits.iter().map(|c| releases[c.release_id].version)
        .collect::<Vec<_>>().join(", ");
    format!("{}, ({})", user.name, release_names);
})

Something like that.

@sgrif
Copy link
Contributor

sgrif commented Mar 19, 2017

For future reference, you're supposed to say my name 3 times to summon me. :trollface:

@steveklabnik
Copy link
Member

Ah, interesting to see how you'd tackle this. Thanks so much ❤️

@sgrif
Copy link
Contributor

sgrif commented Mar 19, 2017

Could have let Diesel do the grouping of Releases too, but it'd result in a lot of unnecessary cloning.

@steveklabnik
Copy link
Member

Yeah, with more complex stuff like this, it's hard to tell what's better in the DB and what's better in Rust. I mean, we'll have so few entries here it doesn't matter either way....

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants