Page MenuHomePhabricator

[Backend] Logging uploads on Google Drive to Commons tool
Closed, ResolvedPublic

Description

Task

  1. We need a stat counter to track the number of files uploaded via the tool. We can show that later on the screen ? We can implement this as part of a logging system in the database.
  2. I am thinking of a stat table to look like this. We do not really want to store the upload file on our database anyway:
id: counter 
username: Wikimedia username 
number_of_files: Number of files uploaded 
created_at: datetime of the time of event
  1. Lets save it once an upload goes through. You can read more about django models and creating objects at: https://docs.djangoproject.com/en/3.0/ref/models/instances/#creating-objects

Required skills
python-django, python, some js

Setup Guide for GCI students
You have to setup the python-django tool Gdrive to Commons locally to start with contributing. You can read how to setup the tool on your machine here.
We host our code on Github, so the change should come in as a pull request to https://github.com/tonythomas01/gdrive_to_commons. Steps to contribute are similar to Pull request workflow. Or, you can rely on the following:

  1. Create a local fork of https://github.com/tonythomas01/gdrive_to_commons using your account.
  2. Create a branch with the phabricator task name from origin/master. For eg, git checkout -b T55445 origin/master. Make sure to update your local branch by git pull --rebase or whatever necessary before creating a branch.
  3. Fix the issue you are solving.
  4. Commit it (git commit -m "What you fixed goes here")
  5. Push it to your Github fork of the repo (git push -u origin HEAD)
  6. Later, create a pull request to https://github.com/tonythomas01/gdrive_to_commons from Github with your changes.
  7. Would be pretty cool if you also paste your pull request link on your phabricator task so people know that things are moving.

Event Timeline

Later, we should have tasks to make this information available on an API and show it on the homepage as well.

Abbasidaniyal subscribed.

Hi @01tonythomas
I have sent a PR on github for this task. You had asked me to clean up the code a little bit, I've done that as well.
Eagerly waiting for you review and do let me know if I missed out anything.

https://github.com/tonythomas01/gdrive-to-commons/pull/29

Thank you!

Hi @Abbasidaniyal
I have found that the counter is not working as expected and is displaying the count as 5 all the time (even when we are not logged into Wikimedia commons) as shown below.

image.png (988×1 px, 527 KB)

Thank you!

The counter display the total number of files uploaded using the tool by all users. Not a particular user.

This issue has been resolved and the corresponding PR has been merged.
https://github.com/tonythomas01/gdrive-to-commons/pull/29