Skip to content

Commit

Permalink
Merge pull request #2309 from instructure/release/student-7.1.0-259
Browse files Browse the repository at this point in the history
Release Student 7.1.0 (259)
  • Loading branch information
hermannakos authored Jan 30, 2024
2 parents 042514c + 6aa2d09 commit bd6ec42
Show file tree
Hide file tree
Showing 273 changed files with 4,568 additions and 1,441 deletions.
13 changes: 10 additions & 3 deletions apps/flutter_parent/lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -989,11 +989,18 @@ class AppLocalizations {
desc: 'Screen reader-friendly replacement for the "-" character in letter grades like "A-"',
);

String latePenalty(String pointsLost) => Intl.message(
'Late penalty (-$pointsLost)',
String yourGrade(String pointsAchieved) => Intl.message(
'Your grade: $pointsAchieved',
desc: 'Text displayed when a late penalty has been applied to the assignment, this is the achieved score without the penalty',
args: [pointsAchieved],
name: 'yourGrade',
);

String latePenaltyUpdated(String pointsLost) => Intl.message(
'Late Penalty: -$pointsLost pts',
desc: 'Text displayed when a late penalty has been applied to the assignment',
args: [pointsLost],
name: 'latePenalty',
name: 'latePenaltyUpdated',
);

String finalGrade(String grade) => Intl.message(
Expand Down
12 changes: 9 additions & 3 deletions apps/flutter_parent/lib/models/grade_cell_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ abstract class GradeCellData implements Built<GradeCellData, GradeCellDataBuilde
String get grade;
String get gradeContentDescription;
String get outOf;
String get yourGrade;
String get latePenalty;
String get finalGrade;

Expand All @@ -58,6 +59,7 @@ abstract class GradeCellData implements Built<GradeCellData, GradeCellDataBuilde
..grade = ''
..gradeContentDescription = ''
..outOf = ''
..yourGrade = ''
..latePenalty = ''
..finalGrade = '';

Expand Down Expand Up @@ -125,8 +127,8 @@ abstract class GradeCellData implements Built<GradeCellData, GradeCellDataBuilde
..graphPercent = 1.0);
}

var score = NumberFormat.decimalPattern().format(submission.enteredScore);
var graphPercent = (submission.enteredScore / assignment.pointsPossible).clamp(0.0, 1.0);
var score = NumberFormat.decimalPattern().format(submission.score);
var graphPercent = (submission.score / assignment.pointsPossible).clamp(0.0, 1.0);

// If grading type is Points, don't show the grade since we're already showing it as the score
var grade = assignment.gradingType != GradingType.points ? submission.grade ?? '' : '';
Expand All @@ -138,6 +140,7 @@ abstract class GradeCellData implements Built<GradeCellData, GradeCellDataBuilde
// Screen reader fails on letter grades with a minus (e.g. 'A-'), so we replace the dash with the word 'minus'
var accessibleGradeString = grade.replaceAll('-', '. ${l10n.accessibilityMinus}');

var yourGrade = '';
var latePenalty = '';
var finalGrade = '';
var restrictedScore = grade;
Expand All @@ -146,7 +149,9 @@ abstract class GradeCellData implements Built<GradeCellData, GradeCellDataBuilde
if ((submission.pointsDeducted ?? 0.0) > 0.0) {
grade = ''; // Grade will be shown in the 'final grade' text
var pointsDeducted = NumberFormat.decimalPattern().format(submission.pointsDeducted ?? 0.0);
latePenalty = l10n.latePenalty(pointsDeducted);
var pointsAchieved = NumberFormat.decimalPattern().format(submission.enteredScore);
yourGrade = l10n.yourGrade(pointsAchieved);
latePenalty = l10n.latePenaltyUpdated(pointsDeducted);
finalGrade = l10n.finalGrade(submission.grade ?? grade);
}

Expand All @@ -166,6 +171,7 @@ abstract class GradeCellData implements Built<GradeCellData, GradeCellDataBuilde
..outOf = outOfText
..grade = grade
..gradeContentDescription = accessibleGradeString
..yourGrade = yourGrade
..latePenalty = latePenalty
..finalGrade = finalGrade);
}
Expand Down
14 changes: 14 additions & 0 deletions apps/flutter_parent/lib/models/grade_cell_data.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ class AccountCreationInteractor {
}

launchPrivacyPolicy() {
locator<UrlLauncher>().launch('https://www.instructure.com/canvas/privacy');
locator<UrlLauncher>().launch('https://www.instructure.com/policies/product-privacy-policy');
}
}
71 changes: 42 additions & 29 deletions apps/flutter_parent/lib/screens/assignments/grade_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import 'package:flutter_parent/models/assignment.dart';
import 'package:flutter_parent/models/course.dart';
import 'package:flutter_parent/models/grade_cell_data.dart';
import 'package:flutter_parent/models/submission.dart';
import 'package:flutter_parent/utils/design/parent_colors.dart';
import 'package:flutter_parent/utils/design/parent_theme.dart';
import 'package:percent_indicator/circular_percent_indicator.dart';

Expand Down Expand Up @@ -134,37 +135,49 @@ class GradeCell extends StatelessWidget {
],
),
if (!_isGradedRestrictQuantitativeData) SizedBox(width: 16),
if (!_isGradedRestrictQuantitativeData) Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
if (data.grade.isNotEmpty)
Text(
data.grade,
key: Key('grade-cell-grade'),
style: Theme.of(context).textTheme.headlineMedium,
semanticsLabel: data.gradeContentDescription,
),
if (data.outOf.isNotEmpty) Text(data.outOf, key: Key('grade-cell-out-of')),
if (data.latePenalty.isNotEmpty)
Text(
data.latePenalty,
style: TextStyle(color: data.accentColor),
key: Key('grade-cell-late-penalty'),
),
if (data.finalGrade.isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 8),
child: Text(
data.finalGrade,
key: Key('grade-cell-final-grade'),
style: Theme.of(context).textTheme.titleMedium,
if (!_isGradedRestrictQuantitativeData)
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
if (data.grade.isNotEmpty)
Text(
data.grade,
key: Key('grade-cell-grade'),
style: Theme.of(context).textTheme.headlineMedium,
semanticsLabel: data.gradeContentDescription,
),
if (data.outOf.isNotEmpty) Text(data.outOf, key: Key('grade-cell-out-of')),
if (data.yourGrade.isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
data.yourGrade,
key: Key('grade-cell-your-grade'),
),
),
if (data.latePenalty.isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
data.latePenalty,
style: TextStyle(color: ParentColors.failure),
key: Key('grade-cell-late-penalty'),
),
),
if (data.finalGrade.isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
data.finalGrade,
key: Key('grade-cell-final-grade'),
style: Theme.of(context).textTheme.titleMedium,
),
),
),
],
],
),
),
),
],
);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/flutter_parent/lib/screens/settings/legal_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class LegalScreen extends StatelessWidget {
children: <Widget>[
_LegalRow(
label: l10n.privacyPolicy,
onTap: () => locator<UrlLauncher>().launch('https://www.instructure.com/canvas/privacy'),
onTap: () => locator<UrlLauncher>().launch('https://www.instructure.com/policies/product-privacy-policy'),
icon: CanvasIcons.admin,
),
_LegalRow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void main() {
test('launchPrivacyPolicy calls the url launcher', () {
AccountCreationInteractor().launchPrivacyPolicy();
verify(
launcher.launch('https://www.instructure.com/canvas/privacy'),
launcher.launch('https://www.instructure.com/policies/product-privacy-policy'),
).called(1);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,11 @@ void main() {
..grade = '79'
..score = 79.0);
var expected = baseGradedState.rebuild((b) => b
..graphPercent = 0.85
..score = '85'
..graphPercent = 0.79
..score = '79'
..showPointsLabel = true
..latePenalty = 'Late penalty (-6)'
..yourGrade = 'Your grade: 85'
..latePenalty = 'Late Penalty: -6 pts'
..finalGrade = 'Final Grade: 79');
var actual = GradeCellData.forSubmission(baseCourse, baseAssignment, submission, theme, l10n);
expect(actual, expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_parent/l10n/app_localizations.dart';
import 'package:flutter_parent/models/grade_cell_data.dart';
import 'package:flutter_parent/screens/assignments/grade_cell.dart';
import 'package:flutter_parent/utils/design/parent_colors.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:percent_indicator/circular_percent_indicator.dart';

Expand Down Expand Up @@ -158,11 +159,13 @@ void main() {
GradeCellData data = GradeCellData((b) => b
..state = GradeCellState.graded
..accentColor = Colors.pinkAccent
..latePenalty = 'Late penalty: (-25)');
..yourGrade = 'Your grade: 85'
..latePenalty = 'Late penalty: -25');
await setupWithData(tester, data);

expect(find.byKey(Key('grade-cell-late-penalty')).evaluate(), find.text(data.latePenalty).evaluate());
expect(tester.widget<Text>(find.byKey(Key('grade-cell-late-penalty'))).style!.color, data.accentColor);
expect(find.byKey(Key('grade-cell-your-grade')).evaluate(), find.text(data.yourGrade).evaluate());
expect(tester.widget<Text>(find.byKey(Key('grade-cell-late-penalty'))).style!.color, ParentColors.failure);
});

testWidgetsWithAccessibilityChecks('Displays final grade text', (tester) async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void main() {
await tester.tap(find.text(l10n.privacyPolicy));
await tester.pumpAndSettle();

verify(mockLauncher.launch('https://www.instructure.com/canvas/privacy')).called(1);
verify(mockLauncher.launch('https://www.instructure.com/policies/product-privacy-policy')).called(1);
});

testWidgetsWithAccessibilityChecks('tapping github launches url', (tester) async {
Expand Down
4 changes: 0 additions & 4 deletions apps/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ include ':pandautils'
include ':rceditor'
include ':recyclerview'
include ':pandares'
include ':panda_annotations'
include ':panda_processor'
include ':DocumentScanner'

project(':annotations').projectDir = new File(rootProject.projectDir, '/../libs/annotations')
Expand All @@ -38,6 +36,4 @@ project(':pandautils').projectDir = new File(rootProject.projectDir, '/../libs/p
project(':rceditor').projectDir = new File(rootProject.projectDir, '/../libs/rceditor')
project(':recyclerview').projectDir = new File(rootProject.projectDir, '/../libs/recyclerview')
project(':pandares').projectDir = new File(rootProject.projectDir, '/../libs/pandares')
project(':panda_annotations').projectDir = new File(rootProject.projectDir, '/../libs/panda_annotations')
project(':panda_processor').projectDir = new File(rootProject.projectDir, '/../libs/panda_processor')
project(':DocumentScanner').projectDir = new File(rootProject.projectDir, '/../libs/DocumentScanner')
6 changes: 2 additions & 4 deletions apps/student/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ android {
applicationId "com.instructure.candroid"
minSdkVersion Versions.MIN_SDK
targetSdkVersion Versions.TARGET_SDK
versionCode = 258
versionName = '7.0.2'
versionCode = 259
versionName = '7.1.0'

vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
Expand Down Expand Up @@ -244,8 +244,6 @@ android {
}

dependencies {
implementation project(path: ':panda_annotations')
kaptAndroidTestQa project(path: ':panda_processor')

implementation fileTree(dir: 'libs', include: ['*.jar'])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package com.instructure.student.espresso

import androidx.work.Configuration
import androidx.work.WorkerFactory
import com.instructure.student.util.BaseAppManager

Expand All @@ -25,8 +24,6 @@ open class TestAppManager : BaseAppManager() {
var workerFactory: WorkerFactory? = null

override fun getWorkManagerFactory(): WorkerFactory {
return workerFactory?.let {
it
} ?: WorkerFactory.getDefaultWorkerFactory()
return workerFactory ?: WorkerFactory.getDefaultWorkerFactory()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ package com.instructure.student.ui.e2e
import android.util.Log
import androidx.test.espresso.Espresso
import com.instructure.canvas.espresso.E2E
import com.instructure.canvas.espresso.FeatureCategory
import com.instructure.canvas.espresso.Priority
import com.instructure.canvas.espresso.TestCategory
import com.instructure.canvas.espresso.TestMetaData
import com.instructure.canvas.espresso.refresh
import com.instructure.canvasapi2.models.DiscussionEntry
import com.instructure.dataseeding.api.DiscussionTopicsApi
import com.instructure.panda_annotations.FeatureCategory
import com.instructure.panda_annotations.Priority
import com.instructure.panda_annotations.TestCategory
import com.instructure.panda_annotations.TestMetaData
import com.instructure.student.ui.utils.StudentTest
import com.instructure.student.ui.utils.seedData
import com.instructure.student.ui.utils.tokenLogin
Expand Down
Loading

0 comments on commit bd6ec42

Please sign in to comment.