Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve solution collector #818

Merged
merged 4 commits into from
Jul 30, 2018
Merged

Conversation

unrealhoang
Copy link
Collaborator

  • Refactor
  • Add structopt for params parsing
  • Concise submit parsing

@unrealhoang unrealhoang requested a review from ldhnam July 23, 2018 01:47
}

#[derive(Debug)]
struct SubmitEntry {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@unrealhoang Could you add a field for submitted date, and using this field for checking a PR is submitted after the deadline?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch, will add it.

println!("Fetching Page {}", page);

let (_, _, pulls) = client.get()
let (_, _, pulls) = ctx.client.get()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you filtered out all PR that are submitted after the deadline, or better mark them as due-date :D

@tamnd
Copy link
Contributor

tamnd commented Jul 23, 2018

Should we bump the version to 0.1.1? :3

},
#[structopt(name = "merge")]
Merge {
week: u32,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any logical difference between WeekReport::week and Merge::week. Aren't they supposed to be the same?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@huytd: week report is for, well, week report 😂. It will only show that week’s submissions, compare them against PARTICIPANTS list, group submitted entries by number of solved problem.

}

#[derive(Debug)]
struct Problem {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a better name so it should not be confusing. For example, Submission (instead of SubmitEntry), and Entry (instead of Problem).

Using Problem here makes me think about a data structure to store parser's error results.

}).collect()
}

fn parse_pull_request(pr: &Value) -> Option<SubmitEntry> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we can just name it PullRequest instead of SubmitEntry

}

fn get_week(title: &str) -> u64 {
fn get_week(title: &str) -> u32 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we name this funciton parse_week, and instead of returning 0 if we cannot parse, should we return Option<u32>?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upvote for parse_week, so it would be consistent with other function names in this impl.

@huytd huytd merged commit 216d5b8 into ruby-vietnam:master Jul 30, 2018
@unrealhoang unrealhoang deleted the improve_collector branch July 30, 2018 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants