Skip to content
This repository has been archived by the owner on Aug 19, 2018. It is now read-only.

Commit

Permalink
Merge pull request #6 from ch3nkula/dev
Browse files Browse the repository at this point in the history
Enhancement of submitter patch page & shell script
  • Loading branch information
xSavitar authored Mar 2, 2018
2 parents a5323ad + a8391af commit 251fb61
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
9 changes: 5 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,29 @@ def index(month=None):
""" Default / Home page of the application / tool. """
if month == None:
month = getCurrentMonth() # make month format human-readable
monthID = month
stats = getStatsFromDb(month)
submitters = getSubmitters(stats)

# check wether there are entries in db
formatted = datetime.strptime(month, ("%Y-%m"))
if dbHasMonth(month) == True:
return render_template('index.html', stats = stats,
month = formatted.strftime("%B, %Y"), submitters = submitters)
month = formatted.strftime("%B, %Y"), submitters = submitters, monthID = monthID)
else:
return render_template('loader.html', month = month, formatted = formatted.strftime("%B, %Y"))


@app.route('/submitter/<username>')
def submitter(username):
@app.route('/submitter/<username>/<month>')
def submitterPatchesByMonth(username, month):
""" REST endpoint for list of submitter patche(s). """
Submitter = Query()
db = getDb()

# filter by username
patches = db.search(Submitter.username == username)

return render_template('submitter.html', patches = patches)
return render_template('submitter.html', patches = patches, monthID = month)


def getParticipants():
Expand Down
10 changes: 7 additions & 3 deletions install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
# Author: Derick Alangi
# Description: Check system and install deps

# Checks if Python 3 is installed before executing
# Checks if Python 3 and pip is installed before executing
if command -v python3 &>/dev/null; then
echo Python 3 is installed, installing dependencies...
echo -e "\nPython 3 is installed, checking pip..."
echo -e "pip is installed, now installing dependencies...\n"
else
echo Python 3 is not installed, aborting...
echo "Python 3 is not installed, aborting..."
exit 1
fi

pip install -r requirements.txt

echo -e "\nYou can run the application now!"
2 changes: 1 addition & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h4 class="card-title">{{submitter[0]['name']}}</h4>
<br>
</p>
<p class="card-text"><small class="text-muted">{{submitter[0]['country']}}</small></p>
<a href="/submitter/{{submitter[0]['username']}}" class="btn btn-primary float-left" title="Full details for {{submitter[0]['name']}}">
<a href="/submitter/{{submitter[0]['username']}}/{{monthID}}" class="btn btn-primary float-left" title="Full details for {{submitter[0]['name']}}">
View patches</a>
</div>
</div>
Expand Down
16 changes: 9 additions & 7 deletions templates/submitter.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ <h2>Stats for {{patches[0]['name']}}</h2>
</thead>
<tbody>
{% for patch in patches %}
<tr>
<td>{{loop.index}}</td>
<td>{{patch.project}}</td>
<td>{{patch.created|datetimeformat}}</td>
<td>{{patch.updated|datetimeformat}}</td>
<td>{{patch.status}}</td>
</tr>
{% if monthID in patch.created %}
<tr>
<td>{{loop.index}}</td>
<td>{{patch.project}}</td>
<td>{{patch.created|datetimeformat}}</td>
<td>{{patch.updated|datetimeformat}}</td>
<td>{{patch.status}}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
Expand Down

0 comments on commit 251fb61

Please sign in to comment.