thanks icon indicating copy to clipboard operation
thanks copied to clipboard

users first, not releases

Open tarekziade opened this issue 8 years ago • 7 comments

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

tarekziade avatar Jan 26 '17 21:01 tarekziade

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 avatar Jan 26 '17 21:01 steveklabnik

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 😜

steveklabnik avatar Mar 19 '17 22:03 steveklabnik

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 avatar Mar 19 '17 22:03 sgrif

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

sgrif avatar Mar 19 '17 22:03 sgrif

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

steveklabnik avatar Mar 19 '17 23:03 steveklabnik

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

sgrif avatar Mar 19 '17 23:03 sgrif

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....

steveklabnik avatar Mar 19 '17 23:03 steveklabnik