-
Notifications
You must be signed in to change notification settings - Fork 0
Microtask 1 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yashasingh
wants to merge
33
commits into
master
Choose a base branch
from
development
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Microtask 1 #1
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
d7b2d0e
files to be reviewed
yashasingh 5ad9407
task 2 for review
yashasingh cc7ea89
Incomplete file deleted
yashasingh 8133e9a
changes complete
yashasingh 6dd4900
conflict resolved
yashasingh ef6bda9
conflict resolved
yashasingh 8c861d6
review changes implemented
yashasingh 7bbf540
Sanitized database query
yashasingh db47853
bug fixes done
yashasingh 97357e5
minor bugs fixed
yashasingh 3553348
minor bugs fixed
yashasingh 863165f
minor fixes
yashasingh 2f5e74d
issues fixed
yashasingh efcde18
issues fixed
yashasingh a613a35
issues fixed
yashasingh f5c41a7
issues resolved
yashasingh 8969f0c
percentile issue resolved
yashasingh fee5636
merged code
yashasingh c9e8057
conflict resolved
yashasingh 7659411
minor fixes
yashasingh 66399e5
code cleaned
yashasingh 1581136
merged task1
yashasingh 8df73a2
Merge branch 'devtask2' into complete
yashasingh a8c655b
minor fixes
yashasingh 4c4a59f
code made deployable
yashasingh a7fea46
UI updated
yashasingh f3d082f
minor fixes
yashasingh 75a14b6
code updated
yashasingh 0edfcac
pyc files ignored
yashasingh cb49836
merged master
yashasingh 6e7a318
Merge branch 'complete' of https://github.com/yashasingh/Review into …
yashasingh 7f5fbe8
minor fix
yashasingh 81cd71a
Minor changes
yashasingh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| *.pyc | ||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| {% load static %} | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <title> | ||
| Outreachy Tasks | ||
| </title> | ||
| <link type="text/css" rel="stylesheet" href="https://tools-static.wmflabs.org/cdnjs/ajax/libs/materialize/0.100.2/css/materialize.css" ></link> | ||
| <link href="https://tools-static.wmflabs.org/cdnjs/ajax/libs/font-awesome/4.7.0/css/font-awesome.css"> | ||
| <link type="text/css" rel="stylesheet" href={% static "style.css" %} ></link> | ||
| </head> | ||
| <body> | ||
| <div class="row"> | ||
| <h2 class="center"> Outreachy Microtasks </h2> | ||
| </div> | ||
| <div class="row"> | ||
| <div class="col s12 m6"> | ||
| <div class="card blue lighten-2"> | ||
| <div class="card-content white-text"> | ||
| <span class="card-title">User Contribution Summary</span> | ||
| <p>A simple tool that takes a username and lists the recent English Wikipedia edits of that user</p> | ||
| </div> | ||
| <div class="card-action"> | ||
| <a class="pointer" href="https://github.com/yashasingh/Review/pull/1">Github</a> | ||
| <a class="pointer" href="{% url 'App:get_recent_english_edits' %}">Microtask1</a> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="col s12 m6"> | ||
| <div class="card blue lighten-2"> | ||
| <div class="card-content white-text"> | ||
| <span class="card-title">User Percentile</span> | ||
| <p>A simple tool that takes a username and tells what percentile the user is at by number of edits.</p> | ||
| </div> | ||
| <div class="card-action"> | ||
| <a class="pointer" href="https://github.com/yashasingh/Review/pull/2">Github</a> | ||
| <a class="pointer" href="{% url 'App:get_the_user_percentile' %}">Microtask2</a> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| {% load static %} | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <title> | ||
| Microtask 1 | ||
| </title> | ||
| <link type="text/css" rel="stylesheet" href="https://tools-static.wmflabs.org/cdnjs/ajax/libs/materialize/0.100.2/css/materialize.css" ></link> | ||
| <link type="text/css" rel="stylesheet" href={% static "style.css" %} ></link> | ||
| </head> | ||
| <body> | ||
| <div class="row"> | ||
| <nav> | ||
| <div class="nav-wrapper pd-left-20"> | ||
| <a href="{% url 'App:get_recent_english_edits' %}" class="brand-logo">Microtask 1: Recent english edits</a> | ||
| <ul id="nav-mobile" class="right hide-on-med-and-down"> | ||
| <li><a href="{% url 'App:get_the_user_percentile' %}">Microtask2</a></li> | ||
| <li><a href="{% url 'App:index' %}">Home</a></li> | ||
| </ul> | ||
| </div> | ||
| </nav> | ||
| </div> | ||
| <center><h4>Tool to display the recent English Wikipedia edits of that user</h4></center> | ||
| <div class="row"> | ||
| <form class="col s12" method="post"> | ||
| {% csrf_token %} | ||
| <div class="row"> | ||
| <div class="input-field col s6 m6 offset-m3"> | ||
| <input id="username" name="username" type="text"> | ||
| <label for="username">Username</label> | ||
| </div> | ||
| </div> | ||
| <div class="row"> | ||
| <div class="col s6 m6 offset-m3"> | ||
| <button class="btn waves-effect waves-light blue-color" type="submit" name="action">Search | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </form> | ||
| </div> | ||
| {% if error %} | ||
| <div class="row"> | ||
| <div class="col s12 m6 offset-m3"> | ||
| <div class="card blue lighten-2"> | ||
| <div class="card-content white-text"> | ||
| {{error}} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| {% endif %} | ||
| <!-- loop --> | ||
| {% for x in contribution %} | ||
|
|
||
| <div class="row"> | ||
| <div class="col s12 m6 offset-m3"> | ||
| <div class="card blue lighten-2"> | ||
| <div class="card-content white-text"> | ||
| <span class="card-title"> User : {{x.user}}</span> | ||
| <ul> | ||
| <li>Title = {{x.title}} </li> | ||
| <li>PageID = {{x.pageid}} </li> | ||
| <li>RevisionID = {{x.revid}} </li> | ||
| <li>ParentID = {{x.parentid}} </li> | ||
| <li>ns = {{x.ns}}</li> | ||
| <li>Timestamp = {{x.timestamp}} </li> | ||
| <li>Size = {{x.size}} </li> | ||
| <li><a href="https://en.wikipedia.org/w/index.php?title=User:{{x.user}}&diff=prev&oldid={{x.revid}}"> | ||
| Click here to view the edit. | ||
| </a> </li> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| {% endfor %} | ||
| </body> | ||
| </html> | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,11 @@ | ||
| from django.conf.urls import url | ||
|
|
||
| from . import views | ||
|
|
||
| app_name='App' | ||
| urlpatterns = [ | ||
| url(r'^$', views.index, name='index'), | ||
| url(r'^Microtask1/', views.get_recent_english_edits, name='get_recent_english_edits'), | ||
| url(r'^Microtask2/', views.get_the_user_percentile, name='get_the_user_percentile'), | ||
| ] | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import json | ||
| import requests | ||
| import urllib.parse | ||
|
|
||
| from django.http import HttpResponse | ||
| from django.shortcuts import render | ||
|
|
||
|
|
||
| def get_recent_english_edits(request): | ||
| """ | ||
| Display the recent english edits of the user. | ||
| """ | ||
|
|
||
| if request.method == 'POST': | ||
|
|
||
| # Here, we get the username | ||
| username = request.POST['username'] | ||
| # if username is submitted blank | ||
| if not username: | ||
| return render(request, "App/index.html", {"error": "Please enter a username"}) | ||
|
|
||
| # if username is not blank | ||
| params = {'ucuser': username} | ||
|
|
||
| encoded = urllib.parse.urlencode(params) | ||
|
|
||
| URL = "https://en.wikipedia.org/w/api.php?action=query&format=json&list=usercontribs&" | ||
|
|
||
| URL = "{}{}".format(URL, encoded) | ||
|
|
||
| # Recieved data in json-format | ||
| response = requests.get(URL) | ||
|
|
||
| if response.status_code == 200: | ||
| lst = json.loads(response.text) | ||
| try: | ||
| # if username contains invalid value | ||
| if lst['error']: | ||
| return render(request, | ||
| 'App/index.html', | ||
| {"error":lst['error']['info']} | ||
| ) | ||
| except: | ||
| # Contribution data extracted | ||
| sub_lst = lst['query']['usercontribs'] | ||
|
|
||
| # if user has no edits | ||
| if len(sub_lst) == 0: | ||
| return render(request, | ||
| 'App/index.html', | ||
| {"error": "0 edits found for username {}".format(username)}) | ||
|
|
||
| # Send contribution data for display | ||
| return render(request, | ||
| 'App/index.html', | ||
| {"contribution": sub_lst, "username": username}) | ||
| else: | ||
| return render(request, | ||
| 'App/index.html', | ||
| {"error": 'Exit code {}'.format(str(response.status_code)), | ||
| } | ||
| ) | ||
|
|
||
| if request.method == 'GET': | ||
| return render(request, 'App/index.html') | ||
|
|
||
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,4 +5,3 @@ | |
| os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Project.settings") | ||
|
|
||
| app = get_wsgi_application() | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| .center { | ||
| text-align: center; | ||
| } | ||
| .pointer { | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .yellow { | ||
| color: yellow !important; | ||
| } | ||
|
|
||
| nav { | ||
| background-color: #64b5f6; | ||
| color: white; | ||
| } | ||
| input:active ~ label, input:valid ~ label { | ||
| top:-20px; | ||
| font-size:14px; | ||
| color:#5264AE; | ||
| } | ||
|
|
||
| .blue-color { | ||
| background-color: #64b5f6; | ||
| } | ||
|
|
||
| .pd-left-20 { | ||
| padding-left: 20px; | ||
| } | ||
| .btn:hover, .btn-large:hover { | ||
| background-color: #64b5f6; | ||
| } | ||
| .btn:focus, .btn-large:focus, .btn-floating:focus { | ||
| background-color: #64b5f6; | ||
|
|
||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be more readable to put the constant parameters here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.