Skip to content
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
5 changes: 2 additions & 3 deletions carp_core/lib/deployment/domain/study_deployment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class StudyDeployment {
_protocol = protocol;
_creationDate = DateTime.now();
_status = StudyDeploymentStatus(studyDeploymentId: _studyDeploymentId);
_status.createdOn = _creationDate;
}

/// Get the status of this [StudyDeployment].
Expand Down Expand Up @@ -293,9 +294,7 @@ class StudyDeploymentStatus extends Serializable {
StudyDeploymentStatus({
required this.studyDeploymentId,
this.deviceStatusList = const [],
}) : super() {
createdOn = DateTime.now();
}
}) : super();

@override
Function get fromJsonFunction => _$StudyDeploymentStatusFromJson;
Expand Down
21 changes: 19 additions & 2 deletions carp_mobile_sensing/lib/infrastructure/persistence.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,25 @@

part of '../infrastructure.dart';

/// A persistence layer that knows how to persistently store deployment and
/// app task information across app restart.
/// Stores meta data about the running [SmartphoneDeployment] and all
/// [UserTask] json objects in an SQLite database on the device's
/// local storage media. To be used across app restarts.
///
/// Deployments are stored in the `deployment` table and user tasks are stored
/// in the `task_queue` table.
///
/// The path and filename format is
///
/// `~/carp.db`
///
/// where `~` is the folder where SQLite places it database files.
///
/// On iOS, this is the `NSDocumentsDirectory` and the files can be accessed via
/// the MacOS Finder.
///
/// On Android, Flutter files are stored in the `databases` directory, which is
/// located in the `data/data/<package_name>/databases/` folder.
/// Files can be accessed via AndroidStudio.
class Persistence {
static const String DATABASE_NAME = 'carp';
static const String DEPLOYMENT_TABLE_NAME = 'deployment';
Expand Down