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

Removed logic for "upgrade" from the front end code #655

Merged
merged 3 commits into from
Jul 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 0 additions & 31 deletions static/js/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ export const DASHBOARD_RESPONSE = [
"id": 7,
"status": STATUS_ENROLLED_NOT_VERIFIED,
"title": "Not verified run",
"verification_date": "2200-01-01T03:00:00Z",
"course_id": "not-verified",
"position": 0
}
Expand Down Expand Up @@ -257,36 +256,6 @@ export const DASHBOARD_RESPONSE = [
}
]
},
{
"id": 13,
"status": STATUS_ENROLLED_NOT_VERIFIED,
"title": "Enrolled, no verification date - no status text",
"position_in_program": 7,
"runs": [
{
"title": "Enrolled no verification date",
"status": STATUS_ENROLLED_NOT_VERIFIED,
"position": 0,
"course_id": "course_id",
"id": 11
}
]
},
{
"id": 14,
"position_in_program": 8,
"title": "enrolled not verified, verification date passed - no status text",
"status": STATUS_ENROLLED_NOT_VERIFIED,
"runs": [
{
"position": 0,
"id": 12,
"status": STATUS_ENROLLED_NOT_VERIFIED,
"title": "enrolled not verified, verification date passed",
"verification_date": "2000-01-01"
}
]
},
{
"id": 15,
"position_in_program": 9,
Expand Down
20 changes: 4 additions & 16 deletions static/js/util/courseList.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,11 @@ export function makeCourseStatusDisplay(course: Course, now: moment = moment()):
</span>;
}
case STATUS_ENROLLED_NOT_VERIFIED: {
if (!firstRun.verification_date) {
// Invalid case, API should always send a valid verification date
return "";
}

let courseUpgradeUrl = `${SETTINGS.edx_base_url}/course_modes/choose/${firstRun.course_id}/`;

let verificationDate = moment(firstRun.verification_date);
if (verificationDate.isAfter(now, 'day')) {
return <Button bsStyle="success" href={courseUpgradeUrl} target="_blank">
UPGRADE TO VERIFIED
<span className="sr-only"> for {firstRun.title}</span>
</Button>;
} else {
// User cannot verify anymore
return "";
}
return <Button bsStyle="success" href={courseUpgradeUrl} target="_blank">
UPGRADE TO VERIFIED
<span className="sr-only"> for {firstRun.title}</span>
</Button>;
}
case STATUS_OFFERED_NOT_ENROLLED: {
if (!firstRun.enrollment_start_date && firstRun.fuzzy_enrollment_start_date !== undefined ) {
Expand Down
30 changes: 2 additions & 28 deletions static/js/util/courseList_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,44 +99,18 @@ describe('courseList functions', () => {
}, moment(today)), "33%");
});

it("is an enrolled course with no verification date", () => {
assert.equal(renderCourseStatusDisplay({
status: STATUS_ENROLLED_NOT_VERIFIED,
runs: []
}, moment(today)), "");
});

it("is an enrolled course with a verification date of tomorrow", () => {
it("is an enrolled course but not verified", () => {
assert.equal(
renderCourseStatusDisplay({
status: STATUS_ENROLLED_NOT_VERIFIED,
runs: [{
verification_date: tomorrow,
title: "Run title"
}],
}, moment(today)),
"UPGRADE TO VERIFIED for Run title"
);
});

it("is an enrolled course with a verification date of today", () => {
assert.equal(renderCourseStatusDisplay({
status: STATUS_ENROLLED_NOT_VERIFIED,
runs: [{
verification_date: today
}]
}, moment(today)), "");
});

it("is an enrolled course with a verification date of yesterday", () => {
assert.equal(renderCourseStatusDisplay({
status: STATUS_ENROLLED_NOT_VERIFIED,
runs: [{
verification_date: yesterday
}]
}, moment(today)), "");
});

it("is an offered course with no enrollment start date", () => {
assert.equal(renderCourseStatusDisplay({
status: STATUS_OFFERED_NOT_ENROLLED,
Expand Down Expand Up @@ -224,7 +198,7 @@ describe('courseList functions', () => {

describe("makeRunStatusDisplay", () => {
it('shows Course passed when a course is passed', () => {
assert.equal("Passed", makeRunStatusDisplay({
assert.equal("Passed", makeRunStatusDisplay({
status: STATUS_PASSED,
runs: []
}));
Expand Down