You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
839 B
37 lines
839 B
import '../models/question.dart';
|
|
|
|
/// A single attempt/quiz session.
|
|
class Attempt {
|
|
/// Unique identifier for this attempt.
|
|
final String id;
|
|
|
|
/// List of questions included in this attempt.
|
|
final List<Question> questions;
|
|
|
|
/// Timestamp when the attempt was started (milliseconds since epoch).
|
|
final int startTime;
|
|
|
|
const Attempt({
|
|
required this.id,
|
|
required this.questions,
|
|
required this.startTime,
|
|
});
|
|
|
|
/// Creates a copy of this attempt with the given fields replaced.
|
|
Attempt copyWith({
|
|
String? id,
|
|
List<Question>? questions,
|
|
int? startTime,
|
|
}) {
|
|
return Attempt(
|
|
id: id ?? this.id,
|
|
questions: questions ?? this.questions,
|
|
startTime: startTime ?? this.startTime,
|
|
);
|
|
}
|
|
|
|
/// Number of questions in this attempt.
|
|
int get questionCount => questions.length;
|
|
}
|
|
|