Skip to content
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

(Contributor Recognition Infrastructure) Milestone2.4: Add certificate generation for contributors (including service method, API controller) #16513

Merged
merged 156 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
c798e78
service file name changed to backend-api
chris7716 Jan 9, 2021
218b79c
backend api file added
chris7716 Jan 9, 2021
d03d579
previous service file removed from CODEOWNERS
chris7716 Jan 9, 2021
536a551
new backend service file added to CODEOWNERS
chris7716 Jan 9, 2021
b853c9a
Merge remote-tracking branch 'upstream/develop' into develop
chris7716 Jan 18, 2021
cab061f
Merge remote-tracking branch 'upstream/develop' into develop
chris7716 Jan 19, 2021
7f746b9
Merge remote-tracking branch 'upstream/develop' into develop
chris7716 Jan 29, 2021
63a9988
Merge branch 'oppia:develop' into develop
chris7716 Oct 1, 2021
40e6c29
Merge branch 'oppia:develop' into develop
chris7716 Nov 12, 2021
1e042a8
Merge branch 'develop' of https://github.com/oppia/oppia into develop
chris7716 Aug 23, 2022
6d2e59b
Merge branch 'develop' of https://github.com/oppia/oppia into develop
chris7716 Aug 27, 2022
ec06909
Merge branch 'develop' of https://github.com/oppia/oppia into develop
chris7716 Sep 9, 2022
82b8dae
Merge branch 'develop' of https://github.com/oppia/oppia into develop
chris7716 Sep 20, 2022
ac53598
First pass
chris7716 Sep 27, 2022
e211ca5
First pass
chris7716 Sep 27, 2022
4573973
Finalize views
chris7716 Oct 12, 2022
fb63259
Add stats component
chris7716 Oct 12, 2022
09f468a
Resolve conflicts and refactor new component
chris7716 Oct 14, 2022
d214681
Cover tests for stats component
chris7716 Oct 17, 2022
53b2d18
Improve mobile views
chris7716 Oct 21, 2022
2fb9fee
Remove mock responses
chris7716 Oct 21, 2022
d0da489
Remove unwanted spaces
chris7716 Oct 21, 2022
99f6370
Add question stats update
chris7716 Oct 22, 2022
e7b36a9
First pass
chris7716 Nov 1, 2022
9f920c5
Add minor changes
chris7716 Nov 1, 2022
d0d071b
Address comments
chris7716 Nov 2, 2022
f9f5aea
First pass
chris7716 Nov 8, 2022
9b30d40
Add new component
chris7716 Nov 8, 2022
b531b27
Address changes
chris7716 Nov 10, 2022
0b3b099
Rollback unwanted changes
chris7716 Nov 10, 2022
b809d10
Add initial changes
chris7716 Nov 11, 2022
1ce5521
Address comments
chris7716 Nov 12, 2022
f25c22c
Merge branch 'develop' of https://github.com/oppia/oppia into milesto…
chris7716 Nov 14, 2022
fd17e52
AAddress comments
chris7716 Nov 15, 2022
71027ce
Address comments
chris7716 Nov 15, 2022
03f0520
Remove language from PageableStats
chris7716 Nov 15, 2022
464a643
Address more comments
chris7716 Nov 16, 2022
5185a0a
Merge branch 'milestone2.2' of https://github.com/chris7716/oppia int…
chris7716 Nov 16, 2022
4eb23e3
Address more comments
chris7716 Nov 16, 2022
4386afe
Remove unwanted changes
chris7716 Nov 16, 2022
0452ed7
Address more comments
chris7716 Nov 17, 2022
98a5b45
Fix checks
chris7716 Nov 17, 2022
b9988aa
Fix checks
chris7716 Nov 17, 2022
db831ae
Fix checks
chris7716 Nov 17, 2022
81d9631
Fix checks
chris7716 Nov 17, 2022
de42554
Fix checks
chris7716 Nov 17, 2022
37d34c5
Fix checks
chris7716 Nov 17, 2022
85ebdc4
Fix checks
chris7716 Nov 17, 2022
396ad54
Fix checks
chris7716 Nov 17, 2022
fbb9297
Fix checks
chris7716 Nov 17, 2022
3f6bce0
Fix checks
chris7716 Nov 17, 2022
dbc75cc
Fix checks
chris7716 Nov 17, 2022
235d239
Fix checks
chris7716 Nov 17, 2022
629ad5e
Fix checks
chris7716 Nov 17, 2022
6eca00f
Fix checks
chris7716 Nov 17, 2022
bc3a956
Fix checks
chris7716 Nov 17, 2022
cae961b
Address comments
chris7716 Nov 17, 2022
8f916fe
Fix checks
chris7716 Nov 18, 2022
d59efdc
Fix checks
chris7716 Nov 18, 2022
c82bd7d
Fix checks
chris7716 Nov 18, 2022
d42a694
Fix checks
chris7716 Nov 18, 2022
c91ea46
Fix checks
chris7716 Nov 18, 2022
a679859
Fix checks
chris7716 Nov 18, 2022
03b5447
Fix checks
chris7716 Nov 18, 2022
e17316d
Fix checks
chris7716 Nov 18, 2022
49c6873
Fix checks
chris7716 Nov 18, 2022
dfce935
Fix checks
chris7716 Nov 18, 2022
2536999
Fix checks
chris7716 Nov 18, 2022
ccb99ad
Fix checks
chris7716 Nov 18, 2022
990ed1d
Fix checks
chris7716 Nov 18, 2022
e5ded5d
Fix checks
chris7716 Nov 18, 2022
773fbe1
Fix checks
chris7716 Nov 18, 2022
cac4619
Fix checks
chris7716 Nov 18, 2022
d442f5c
Fix checks
chris7716 Nov 18, 2022
018f498
Fix checks
chris7716 Nov 18, 2022
f23b1bb
Fix checks
chris7716 Nov 18, 2022
8b3814c
Resolve conflicts
chris7716 Nov 18, 2022
a04050f
Addressed comments
chris7716 Nov 18, 2022
db8b955
Merge branch 'milestone2.2' of https://github.com/chris7716/oppia int…
chris7716 Nov 19, 2022
18058b6
Fix comments
chris7716 Nov 19, 2022
687c494
Address comments
chris7716 Nov 20, 2022
5c7b82d
Fix dates
chris7716 Nov 20, 2022
2146998
Update branch[C
chris7716 Nov 21, 2022
42216f4
Fix tests
chris7716 Nov 21, 2022
68ddfeb
Update branch[C
chris7716 Nov 21, 2022
b01fb27
Fix fe tests
chris7716 Nov 21, 2022
d360b8b
Address changes
chris7716 Nov 21, 2022
3a707c4
Address changes
chris7716 Nov 21, 2022
b24ed22
Address changes
chris7716 Nov 21, 2022
496ef43
Address changes
chris7716 Nov 21, 2022
31de14a
Address changes
chris7716 Nov 21, 2022
6643673
Address changes
chris7716 Nov 21, 2022
544acea
Address changes
chris7716 Nov 21, 2022
0f0ac82
Address changes
chris7716 Nov 21, 2022
9aeff51
Compress svgs
chris7716 Nov 21, 2022
e43bb52
Address changes
chris7716 Nov 22, 2022
e0709a1
Address changes
chris7716 Nov 22, 2022
0225537
Address changes
chris7716 Nov 22, 2022
d0e77ff
Address changes
chris7716 Nov 23, 2022
85b54fc
Resolve conflicts
chris7716 Nov 23, 2022
50d919a
Resolve conflicts
chris7716 Nov 25, 2022
31c86d4
Cooment address
chris7716 Nov 25, 2022
f8f4426
fix nits
chris7716 Nov 25, 2022
bbd2d18
Add logo for the certificate
chris7716 Nov 25, 2022
670bfe1
Address eval comments
chris7716 Nov 26, 2022
f782890
Update
chris7716 Nov 26, 2022
77493b7
Address comments
chris7716 Nov 26, 2022
41da8f3
Address comments
chris7716 Nov 26, 2022
aba7fe1
Address comments
chris7716 Nov 26, 2022
78652f8
Address comments
chris7716 Nov 26, 2022
4ca2bdf
Fix lint
chris7716 Nov 26, 2022
1cb6391
Fix lint
chris7716 Nov 26, 2022
e532dc9
Fix lint
chris7716 Nov 26, 2022
3dac23d
Fix lint
chris7716 Nov 26, 2022
b5ecdf5
Fix lint
chris7716 Nov 26, 2022
b2de5f9
Fix lint
chris7716 Nov 26, 2022
9ebc01d
Fix lint
chris7716 Nov 26, 2022
38e61d1
Address comments and fix checks
chris7716 Nov 27, 2022
ea61791
Address comments and fix checks
chris7716 Nov 27, 2022
861661e
Address comments and fix checks
chris7716 Nov 27, 2022
5e7db44
Address comments and fix checks
chris7716 Nov 27, 2022
66d57a9
Address comments and fix checks
chris7716 Nov 27, 2022
597bd42
Merge branch 'develop' of https://github.com/oppia/oppia into milesto…
chris7716 Nov 27, 2022
afabab3
Address comments and fix checks
chris7716 Nov 27, 2022
c9ef252
Address comments and fix checks
chris7716 Nov 27, 2022
ad379ed
Address comments and fix checks
chris7716 Nov 28, 2022
fb948aa
Address comments and fix checks
chris7716 Nov 28, 2022
0fd619d
Merge branch 'develop' of https://github.com/oppia/oppia into milesto…
chris7716 Nov 28, 2022
3d29a00
Address comments and fix checks
chris7716 Nov 28, 2022
a6a75ae
Address comments and fix checks
chris7716 Nov 28, 2022
3267f34
Address comments and fix checks
chris7716 Nov 28, 2022
4206987
Address comments and fix checks
chris7716 Nov 28, 2022
ad06a77
Remove lib and use html canvas
chris7716 Dec 5, 2022
32b26a4
fix tests
chris7716 Dec 5, 2022
40c4bf9
fix tests
chris7716 Dec 5, 2022
50e7978
Fix bugs
chris7716 Dec 6, 2022
a8b0f5a
Fix nits
chris7716 Dec 6, 2022
a9e2b60
Address changes
chris7716 Dec 11, 2022
6078309
Address changes
chris7716 Dec 12, 2022
d9bc1b6
Merge branch 'develop' of https://github.com/oppia/oppia into milesto…
chris7716 Dec 12, 2022
abbbd34
Address changes
chris7716 Dec 12, 2022
3a2d442
Address changes
chris7716 Dec 12, 2022
e1ac5e1
Resolve conflicts
chris7716 Dec 28, 2022
566bf72
Address changes
chris7716 Dec 29, 2022
12f3a76
Address changes
chris7716 Dec 29, 2022
3f9e963
Merge branch 'develop' of https://github.com/oppia/oppia into milesto…
chris7716 Jan 11, 2023
966e1b6
Merge branch 'develop' of https://github.com/oppia/oppia into milesto…
chris7716 Jan 12, 2023
27348f3
Address comments
chris7716 Jan 16, 2023
c46f507
Fix lint
chris7716 Jan 16, 2023
aaf02c0
Fix lint
chris7716 Jan 16, 2023
2ca1cb0
Merge branch 'develop' of https://github.com/oppia/oppia into milesto…
chris7716 Jan 26, 2023
43c8d6e
Address comments
chris7716 Jan 26, 2023
7596dbc
Reduce signature font size
chris7716 Jan 27, 2023
aa5f20d
Merge branch 'develop' of https://github.com/oppia/oppia into milesto…
chris7716 Jan 27, 2023
1d54ca8
Address comments
chris7716 Jan 27, 2023
718a103
Merge branch 'develop' of https://github.com/oppia/oppia into milesto…
chris7716 Jan 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address comments
  • Loading branch information
chris7716 committed Nov 26, 2022
commit 77493b7e525ae8df43770ac1d0f6c54e491b36b6
7 changes: 7 additions & 0 deletions core/controllers/contributor_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,13 @@ def get(self, username, suggestion_type, language, from_date, to_date):
"""Handles GET requests."""
from_datetime = datetime.datetime.strptime(from_date, '%Y-%m-%d')
to_datetime = datetime.datetime.strptime(to_date, '%Y-%m-%d')
if (to_datetime.date() > datetime.datetime.now().date()):
raise self.InvalidInputException(
'To date should not be a future date.')

# Adds one date to the to_date to make sure the contributions within
# the to_date are also counted for the certificate.
to_datetime = to_datetime + datetime.timedelta(days=1)

file = suggestion_services.generate_contributor_certificate(
username, suggestion_type, language, from_datetime,
Expand Down
4 changes: 2 additions & 2 deletions core/domain/suggestion_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -3225,7 +3225,7 @@ def _generate_translation_contributor_certificate(
text-align: center;">
<div style="font-family: 'Roboto';
font-size: 24px; color: #000000; line-height: 10px;">
""" + date + """
""" + date.strftime('%d %b %Y') + """
</div>
<center>
<p style="width: 186px;
Expand Down Expand Up @@ -3446,7 +3446,7 @@ def _generate_question_contributor_certificate(
text-align: center;">
<div style="font-family: 'Roboto';
font-size: 24px; color: #000000; line-height: 10px;">
""" + date + """
""" + date.strftime('%d %b %Y') + """
</div>
<center>
<p style="width: 186px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>
</div>
<div *ngIf="!isUnlocked"
ngbTooltip="{{contributionCount}} more {{contributionSubTypeText.toLowerCase()}} to achieve this badge"
ngbPopover="{{contributionCount}} more {{contributionSubTypeText.toLowerCase()}} to achieve this badge"
class="locked-badge-container"
container="body"
placement="bottom">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export class CertificateDownloadModalComponent {
this.errorMessage = 'Invalid date range.';
return;
}
if (new Date() < new Date(this.toDate)) {
this.errorsFound = true;
this.errorMessage = 'To date should not be a future date';
return;
}
this.certificateDownloading = true;
this.contributionAndReviewService.downloadContributorCertificateAsync(
this.username,
Expand All @@ -69,12 +74,11 @@ export class CertificateDownloadModalComponent {
this.toDate
).then((response: Blob) => {
const dataType = response.type;

const downloadLink = document.createElement('a');

downloadLink.href = window.URL.createObjectURL(
new Blob([response], {type: dataType}));
downloadLink.setAttribute('download', 'certificate');

document.body.appendChild(downloadLink);
downloadLink.click();
this.certificateDownloading = false;
Expand Down