Skip to content

Commit

Permalink
Add period belong to DAO calendar check
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerard097 committed Aug 31, 2023
1 parent 127c779 commit 6c7fe87
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/dao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,7 @@ ACTION dao::initcalendar(uint64_t calendar_id, uint64_t next_period)
Edge(get_self(), get_self(), calendar_id, next_period, common::START);
}

const size_t MAX_ITS_PER_ACTION = 40;
const size_t MAX_ITS_PER_ACTION = 50;

size_t i = 0;

Expand Down
11 changes: 7 additions & 4 deletions src/proposals/assignment_proposal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,19 @@ namespace hypha
static_cast<uint64_t>(startPeriod->getAs<int64_t>()),
common::PERIOD
);

// EOS_CHECK(
// period.getStartTime().sec_since_epoch() >= eosio::current_time_point().sec_since_epoch(),
// "Only future periods are allowed for starting period"
// )

auto calendarId = Edge::get(m_dao.get_self(), period.getID(), common::CALENDAR).getToNode();

//TODO Period: Remove since period refactor will no longer point to DAO
// EOS_CHECK(
// Edge::exists(m_dao.get_self(), period.getID(), m_daoID, common::DAO),
// "Period must belong to the DAO"
// );
EOS_CHECK(
Edge::exists(m_dao.get_self(), m_daoID, calendarId, common::CALENDAR),
"Period must belong to the DAO"
);
} else {
// default START_PERIOD to next period
ContentWrapper::insertOrReplace(
Expand Down
10 changes: 6 additions & 4 deletions src/proposals/badge_assignment_proposal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,13 @@ namespace hypha
common::PERIOD
);

auto calendarId = Edge::get(m_dao.get_self(), period.getID(), common::CALENDAR).getToNode();

//TODO Period: Remove since period refactor will no longer point to DAO
// EOS_CHECK(
// Edge::exists(m_dao.get_self(), period.getID(), m_daoID, common::DAO),
// "Period must belong to the DAO"
// );
EOS_CHECK(
Edge::exists(m_dao.get_self(), m_daoID, calendarId, common::CALENDAR),
"Period must belong to the DAO"
);
}
else {
// default START_PERIOD to next period
Expand Down
4 changes: 3 additions & 1 deletion src/proposals/quest_start_proposal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ namespace hypha
//Check start period
Document period = getItemDoc(START_PERIOD, common::PERIOD, cw);

auto calendarId = Edge::get(m_dao.get_self(), period.getID(), common::CALENDAR).getToNode();

//TODO Period: Remove since period refactor will no longer point to DAO
EOS_CHECK(
Edge::exists(m_dao.get_self(), period.getID(), m_daoID, common::DAO),
Edge::exists(m_dao.get_self(), m_daoID, calendarId, common::CALENDAR),
"Period must belong to the DAO"
);

Expand Down

0 comments on commit 6c7fe87

Please sign in to comment.