GithubHelp home page GithubHelp logo

Comments (9)

cdump avatar cdump commented on June 2, 2024 3

Я думаю тут не нужно гадать как "правильно", а важно как сделано в тестах у организаторов :)

from hlcupdocs.

vird avatar vird commented on June 2, 2024

Есть подозрение, что if (fromAgeTimestamp < userBirthdayTimestamp && userBirthdayTimestamp < toAgeTimestamp) {

from hlcupdocs.

ei-grad avatar ei-grad commented on June 2, 2024

Просто напишите тест.

from hlcupdocs.

ei-grad avatar ei-grad commented on June 2, 2024

Возьмите трех пользователей с возрастом 10, 20 и 30 лет. Придумайте для них birth_date. Посмотрите как по вашей логике будет фильтроваться fromAge=15&toAge=25.

from hlcupdocs.

vird avatar vird commented on June 2, 2024

*Да простят меня орги за копипасту кода.

let mut now : DateTime<Utc> = Utc::now();
now = now.with_hour(0).unwrap();
now = now.with_minute(0).unwrap();
now = now.with_second(0).unwrap();
# ... код ...
let mut from_birth_date : DateTime<Utc> = DateTime::from_utc(NaiveDateTime::from_timestamp(i32::min_value() as i64, 0), Utc);
let mut to_birth_date   : DateTime<Utc> = DateTime::from_utc(NaiveDateTime::from_timestamp(1000*(i32::max_value() as i64), 0), Utc);
if fromAge != i64::min_value() {
  to_birth_date = now.with_year(now.year() - fromAge as i32).unwrap();
}
if toAge != i64::max_value() {
  from_birth_date = now.with_year(now.year() - toAge as i32).unwrap();
}
# ...
# тут цикл

  let birth_date = DateTime::from_utc(NaiveDateTime::from_timestamp(user.birth_date, 0), Utc);
  if birth_date < from_birth_date    {continue};
  if birth_date > to_birth_date      {continue};

Не прокатило. Все-равно 3 битых запроса.
/locations/51977/avg?gender=f&toAge=51

from hlcupdocs.

efgen avatar efgen commented on June 2, 2024

Полагаю, ответ для запроса /locations/51977/avg?gender=f&toAge=51 в котором учитывается пользователь, рождённый 15.08.1966, сгенерирован организаторами до 15.08.2017

from hlcupdocs.

vird avatar vird commented on June 2, 2024

Копипаста с чатика
image

from hlcupdocs.

vird avatar vird commented on June 2, 2024

Рецепт как получить 100% на проде

  1. now = modification time из users_1.json
  2. Зануляем h,m,s
  3. toAge добавляем +1 год
  4. Строгие сравнения

from hlcupdocs.

sat2707 avatar sat2707 commented on June 2, 2024

https://github.com/sat2707/hlcupdocs/blob/master/TECHNICAL_TASK.md#3--Получение-средней-оценки-достопримечательности-locationsidavg

from hlcupdocs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.