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

Commit 251fb61

Browse files
authored
Merge pull request #6 from ch3nkula/dev
Enhancement of submitter patch page & shell script
2 parents a5323ad + a8391af commit 251fb61

4 files changed

Lines changed: 22 additions & 15 deletions

File tree

app.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,29 @@ def index(month=None):
2222
""" Default / Home page of the application / tool. """
2323
if month == None:
2424
month = getCurrentMonth() # make month format human-readable
25+
monthID = month
2526
stats = getStatsFromDb(month)
2627
submitters = getSubmitters(stats)
2728

2829
# check wether there are entries in db
2930
formatted = datetime.strptime(month, ("%Y-%m"))
3031
if dbHasMonth(month) == True:
3132
return render_template('index.html', stats = stats,
32-
month = formatted.strftime("%B, %Y"), submitters = submitters)
33+
month = formatted.strftime("%B, %Y"), submitters = submitters, monthID = monthID)
3334
else:
3435
return render_template('loader.html', month = month, formatted = formatted.strftime("%B, %Y"))
3536

3637

37-
@app.route('/submitter/<username>')
38-
def submitter(username):
38+
@app.route('/submitter/<username>/<month>')
39+
def submitterPatchesByMonth(username, month):
3940
""" REST endpoint for list of submitter patche(s). """
4041
Submitter = Query()
4142
db = getDb()
4243

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

46-
return render_template('submitter.html', patches = patches)
47+
return render_template('submitter.html', patches = patches, monthID = month)
4748

4849

4950
def getParticipants():

install-deps.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
# Author: Derick Alangi
44
# Description: Check system and install deps
55

6-
# Checks if Python 3 is installed before executing
6+
# Checks if Python 3 and pip is installed before executing
77
if command -v python3 &>/dev/null; then
8-
echo Python 3 is installed, installing dependencies...
8+
echo -e "\nPython 3 is installed, checking pip..."
9+
echo -e "pip is installed, now installing dependencies...\n"
910
else
10-
echo Python 3 is not installed, aborting...
11+
echo "Python 3 is not installed, aborting..."
12+
exit 1
1113
fi
1214

1315
pip install -r requirements.txt
16+
17+
echo -e "\nYou can run the application now!"

templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ <h4 class="card-title">{{submitter[0]['name']}}</h4>
1414
<br>
1515
</p>
1616
<p class="card-text"><small class="text-muted">{{submitter[0]['country']}}</small></p>
17-
<a href="/submitter/{{submitter[0]['username']}}" class="btn btn-primary float-left" title="Full details for {{submitter[0]['name']}}">
17+
<a href="/submitter/{{submitter[0]['username']}}/{{monthID}}" class="btn btn-primary float-left" title="Full details for {{submitter[0]['name']}}">
1818
View patches</a>
1919
</div>
2020
</div>

templates/submitter.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ <h2>Stats for {{patches[0]['name']}}</h2>
1414
</thead>
1515
<tbody>
1616
{% for patch in patches %}
17-
<tr>
18-
<td>{{loop.index}}</td>
19-
<td>{{patch.project}}</td>
20-
<td>{{patch.created|datetimeformat}}</td>
21-
<td>{{patch.updated|datetimeformat}}</td>
22-
<td>{{patch.status}}</td>
23-
</tr>
17+
{% if monthID in patch.created %}
18+
<tr>
19+
<td>{{loop.index}}</td>
20+
<td>{{patch.project}}</td>
21+
<td>{{patch.created|datetimeformat}}</td>
22+
<td>{{patch.updated|datetimeformat}}</td>
23+
<td>{{patch.status}}</td>
24+
</tr>
25+
{% endif %}
2426
{% endfor %}
2527
</tbody>
2628
</table>

0 commit comments

Comments
 (0)