Skip to content

Commit

Permalink
fix webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
cleonyc committed Sep 2, 2022
1 parent 3f0c759 commit aaed570
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

mod config;
mod database;
mod logger;
Expand Down
9 changes: 7 additions & 2 deletions src/webhook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ impl SummaryWebhook {

pub async fn update(&mut self, database: Database) -> anyhow::Result<()> {
let gen_messages = gen_summmary_messages(database.clone());
if gen_messages.len() != database.data.len() / 25 + 1{
for index in (database.data.len() / 25 )..gen_messages.len() - (database.data.len() / 25 + 1) {
if gen_messages.len() != self.message_ids.len() {
println!("a");
for index in self.message_ids.len()..gen_messages.len() {
println!("i: {index}");
let msg = &gen_messages[index];
let req = Request::post(&format!("{}?wait=true", self.url.trim_end_matches("/")))
.header("Content-Type", "application/json")
Expand All @@ -61,6 +63,9 @@ impl SummaryWebhook {
.expect("apparently the id from the response is not a number (WTF??)");
self.message_ids.push(id);
}
} else {

println!("B");
}
for (index, msg) in gen_summmary_messages(database.clone()).iter().enumerate() {
self.client
Expand Down

0 comments on commit aaed570

Please sign in to comment.