From d0943f4838e54f0639dccebc199d3453b11cf816 Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Thu, 7 Apr 2022 09:54:36 +0800 Subject: Add Remove announcement button --- contents/ui/main.qml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'contents/ui/main.qml') diff --git a/contents/ui/main.qml b/contents/ui/main.qml index 7241373..48d51b8 100644 --- a/contents/ui/main.qml +++ b/contents/ui/main.qml @@ -45,19 +45,22 @@ Item { // a numeric course id, a space, and a course code line => { return line.split(" ", 2) } ) + announcementsModel.clear() + for (let course of courses) { callApi(`/courses/${course[0]}/activity_stream`, 10, activityStream => { // Get activity stream for each course - for (let activity of activityStream) { + activityStream.forEach((activity, index) => { if (activity.type == "Announcement") { announcementsModel.append({ + index: index, course: course[1], title: activity.title, url: activity.html_url }) } - } + }) }) } } -- cgit v1.2.3