Open Bibo-Joshi opened 3 weeks ago
You can track the changes from the Activity app. Individual vote timestamps are otherwise not tracked (excluding notifications).
Hey, thanks for the reply and the hint! I've looked arount a bit and found the api documentation of the activity app. From what I found out so far, it shows me only events of polls that were either triggered by me or are related to poll shares. Moreover, it does not show activity about me participating in polls but only about poll configuration changes etc. I extracted the following event types:
[
"option_add",
"poll_closed",
"share_delete",
"comment_delete",
"share_change_type",
"poll_delete",
"share_add",
"option_update",
"share_registration",
"poll_update",
"poll_add",
"poll_reopened",
"poll_restore",
"option_delete"
]
Maybe I'm missing something? But even if I can get the poll participation events from that API, I'm not so sure that this would be a feasible solution for me, as it would mean scraping the complete poll-activity log since the poll creating to filter out only the few events that are relevant for the specific poll I'm looking at 🤔
You also have vote_set
Find the events and their constants here: https://github.com/nextcloud/polls/tree/master/lib/Event
Thanks for the hint! I fiddled around a bit more, but I have additional questions
From what I tested, I get the following results
/ocs/v2.php/apps/activity/api/v2/activity?format=json
gives objects with object_type
= poll
and type
= vote_set
(among others)/ocs/v2.php/apps/activity/api/v2/activity/filter?format=json&object_type=poll"
gives only objects with object_type
= ''
and type
= circles_*
. I would have expected this to return all objects with object_type
= poll
and nothing else./ocs/v2.php/apps/activity/api/v2/activity/polls?format=json"
gives objects with object_type
= poll
and type
as listed in https://github.com/nextcloud/polls/issues/3760#issuecomment-2455456446 but not vote_set
. I would have expected this to return all kinds of poll eventsCan you help shed some light on this? Or should I reach out on the activities app repo?
It appears that I can only see events about someone voting in a poll if the poll is owned by me since before the vote took pace. I.e. owner transferral after the vote doesn't make the event visible to me. Am I observing this correctly or am I missing something? Is there a possibility for an admin to get all events for any poll via the activities API? I guess the next best thing would be parsing the db itself …
Assuming that there is a way that i can see all relevant vote_set
events, it looks like I need to
vote_set
eventsvote_set
event for one of the votes in the pollAm I understanding this correctly? If so, that doesn't seem very handy to me and I would repeat my suggestion to make the timestamp of vote_set
available via the polls app api 😅
⚠️ This issue respects the following points: ⚠️
Describe the goal you'd like to achieve
As a poll owner, I want to be able to know when a user voted, because it helps me updating prelimenary plans that I have made based on the votes before the polls end date.
Describe possible solutions
Whenever a user votes for the first time or changes their vote, store the current unix timestamp. Add it to the response of the
/api/v1.0/poll/{pollId}/votes
endpoint.Additional context
Since for these tasks I usually query the data via the API rather than the GUI, it suffice for me to have this info available via the API. Showing the timestamps in the GUI could be an addition later on. Moreover, I don't need the history of all voting changes the user made, just the timestamp of the last activity.