Move convert_stats_graph to StatisticsManager.

This commit is contained in:
levlam 2024-06-16 22:28:07 +03:00
parent 442484d2d5
commit 70f9a53bfc
3 changed files with 11 additions and 5 deletions

View File

@ -249,7 +249,8 @@ class GetStarsRevenueStatsQuery final : public Td::ResultHandler {
auto ptr = result_ptr.move_as_ok();
LOG(DEBUG) << "Receive result for GetStarsRevenueStatsQuery: " << to_string(ptr);
promise_.set_value(td_api::make_object<td_api::starRevenueStatistics>(
convert_stats_graph(std::move(ptr->revenue_graph_)), convert_stars_revenue_status(std::move(ptr->status_)),
StatisticsManager::convert_stats_graph(std::move(ptr->revenue_graph_)),
convert_stars_revenue_status(std::move(ptr->status_)),
ptr->usd_rate_ > 0 ? clamp(ptr->usd_rate_ * 1e2, 1e-18, 1e18) : 1.3));
}

View File

@ -34,7 +34,7 @@ static td_api::object_ptr<td_api::dateRange> convert_date_range(
return td_api::make_object<td_api::dateRange>(obj->min_date_, obj->max_date_);
}
td_api::object_ptr<td_api::StatisticalGraph> convert_stats_graph(
static td_api::object_ptr<td_api::StatisticalGraph> convert_stats_graph(
telegram_api::object_ptr<telegram_api::StatsGraph> obj) {
CHECK(obj != nullptr);
@ -999,4 +999,9 @@ void StatisticsManager::get_channel_differences_if_needed(
source);
}
td_api::object_ptr<td_api::StatisticalGraph> StatisticsManager::convert_stats_graph(
telegram_api::object_ptr<telegram_api::StatsGraph> obj) {
return ::td::convert_stats_graph(std::move(obj));
}
} // namespace td

View File

@ -23,9 +23,6 @@ namespace td {
class Td;
td_api::object_ptr<td_api::StatisticalGraph> convert_stats_graph(
telegram_api::object_ptr<telegram_api::StatsGraph> obj);
class StatisticsManager final : public Actor {
public:
StatisticsManager(Td *td, ActorShared<> parent);
@ -66,6 +63,9 @@ class StatisticsManager final : public Actor {
Promise<td_api::object_ptr<td_api::publicForwards>> promise,
const char *source);
static td_api::object_ptr<td_api::StatisticalGraph> convert_stats_graph(
telegram_api::object_ptr<telegram_api::StatsGraph> obj);
private:
void tear_down() final;