Compare commits
1 Commits
2fb8728856
...
1cfd62c44f
Author | SHA1 | Date |
---|---|---|
Savanni D'Gerinel | 1cfd62c44f |
70
Cargo.nix
70
Cargo.nix
|
@ -655,32 +655,6 @@ rec {
|
|||
};
|
||||
resolvedDefaultFeatures = [ "default" "std" ];
|
||||
};
|
||||
"async-trait" = rec {
|
||||
crateName = "async-trait";
|
||||
version = "0.1.77";
|
||||
edition = "2021";
|
||||
sha256 = "1adf1jh2yg39rkpmqjqyr9xyd6849p0d95425i6imgbhx0syx069";
|
||||
procMacro = true;
|
||||
authors = [
|
||||
"David Tolnay <dtolnay@gmail.com>"
|
||||
];
|
||||
dependencies = [
|
||||
{
|
||||
name = "proc-macro2";
|
||||
packageId = "proc-macro2";
|
||||
}
|
||||
{
|
||||
name = "quote";
|
||||
packageId = "quote";
|
||||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
features = [ "full" "visit-mut" ];
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
"atoi" = rec {
|
||||
crateName = "atoi";
|
||||
version = "2.0.0";
|
||||
|
@ -1513,7 +1487,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
packageId = "syn 2.0.41";
|
||||
features = [ "full" ];
|
||||
}
|
||||
];
|
||||
|
@ -2420,7 +2394,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
packageId = "syn 2.0.41";
|
||||
}
|
||||
];
|
||||
features = {
|
||||
|
@ -2998,10 +2972,6 @@ rec {
|
|||
name = "async-channel";
|
||||
packageId = "async-channel";
|
||||
}
|
||||
{
|
||||
name = "async-trait";
|
||||
packageId = "async-trait";
|
||||
}
|
||||
{
|
||||
name = "chrono";
|
||||
packageId = "chrono";
|
||||
|
@ -3606,7 +3576,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
packageId = "syn 2.0.41";
|
||||
features = [ "full" ];
|
||||
}
|
||||
];
|
||||
|
@ -4371,7 +4341,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
packageId = "syn 2.0.41";
|
||||
features = [ "full" ];
|
||||
}
|
||||
];
|
||||
|
@ -7720,7 +7690,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
packageId = "syn 2.0.41";
|
||||
features = [ "full" ];
|
||||
}
|
||||
];
|
||||
|
@ -8217,7 +8187,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
packageId = "syn 2.0.41";
|
||||
features = [ "full" "visit-mut" ];
|
||||
}
|
||||
];
|
||||
|
@ -8559,9 +8529,9 @@ rec {
|
|||
};
|
||||
"proc-macro2" = rec {
|
||||
crateName = "proc-macro2";
|
||||
version = "1.0.78";
|
||||
version = "1.0.70";
|
||||
edition = "2021";
|
||||
sha256 = "1bjak27pqdn4f4ih1c9nr3manzyavsgqmf76ygw9k76q8pb2lhp2";
|
||||
sha256 = "0fzxg3dkrjy101vv5b6llc8mh74xz1vhhsaiwrn68kzvynxqy9rr";
|
||||
authors = [
|
||||
"David Tolnay <dtolnay@gmail.com>"
|
||||
"Alex Crichton <alex@alexcrichton.com>"
|
||||
|
@ -8695,9 +8665,9 @@ rec {
|
|||
};
|
||||
"quote" = rec {
|
||||
crateName = "quote";
|
||||
version = "1.0.35";
|
||||
version = "1.0.33";
|
||||
edition = "2018";
|
||||
sha256 = "1vv8r2ncaz4pqdr78x7f138ka595sp2ncr1sa2plm4zxbsmwj7i9";
|
||||
sha256 = "1biw54hbbr12wdwjac55z1m2x2rylciw83qnjn564a3096jgqrsj";
|
||||
authors = [
|
||||
"David Tolnay <dtolnay@gmail.com>"
|
||||
];
|
||||
|
@ -10299,7 +10269,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
packageId = "syn 2.0.41";
|
||||
}
|
||||
];
|
||||
features = {
|
||||
|
@ -11778,11 +11748,11 @@ rec {
|
|||
};
|
||||
resolvedDefaultFeatures = [ "clone-impls" "default" "derive" "extra-traits" "full" "parsing" "printing" "proc-macro" "quote" ];
|
||||
};
|
||||
"syn 2.0.48" = rec {
|
||||
"syn 2.0.41" = rec {
|
||||
crateName = "syn";
|
||||
version = "2.0.48";
|
||||
version = "2.0.41";
|
||||
edition = "2021";
|
||||
sha256 = "0gqgfygmrxmp8q32lia9p294kdd501ybn6kn2h4gqza0irik2d8g";
|
||||
sha256 = "0sg2lzkwbwbm229p3kx1yxai43hkc0s1wmk6g47bzhvw8y6b5j24";
|
||||
authors = [
|
||||
"David Tolnay <dtolnay@gmail.com>"
|
||||
];
|
||||
|
@ -12020,7 +11990,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
packageId = "syn 2.0.41";
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -12436,7 +12406,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
packageId = "syn 2.0.41";
|
||||
features = [ "full" ];
|
||||
}
|
||||
];
|
||||
|
@ -12850,7 +12820,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
packageId = "syn 2.0.41";
|
||||
usesDefaultFeatures = false;
|
||||
features = [ "full" "parsing" "printing" "visit-mut" "clone-impls" "extra-traits" "proc-macro" ];
|
||||
}
|
||||
|
@ -13844,7 +13814,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
packageId = "syn 2.0.41";
|
||||
features = [ "full" ];
|
||||
}
|
||||
{
|
||||
|
@ -13934,7 +13904,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
packageId = "syn 2.0.41";
|
||||
features = [ "visit" "full" ];
|
||||
}
|
||||
{
|
||||
|
@ -15418,7 +15388,7 @@ rec {
|
|||
}
|
||||
{
|
||||
name = "syn";
|
||||
packageId = "syn 2.0.48";
|
||||
packageId = "syn 2.0.41";
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ impl RecordProvider for App {
|
|||
.map_err(|_| WriteError::Unhandled)
|
||||
}
|
||||
|
||||
async fn delete_record(&self, _id: RecordId) -> Result<(), WriteError> {
|
||||
async fn delete_record(&self, id: RecordId) -> Result<(), WriteError> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,14 +15,15 @@ You should have received a copy of the GNU General Public License along with Fit
|
|||
*/
|
||||
|
||||
use crate::{
|
||||
app::App,
|
||||
app::{App, RecordProvider},
|
||||
types::DayInterval,
|
||||
view_models::DayDetailViewModel,
|
||||
views::{DayDetailView, HistoricalView, PlaceholderView, View, WelcomeView},
|
||||
};
|
||||
use adw::prelude::*;
|
||||
use chrono::{Duration, Local};
|
||||
|
||||
use emseries::Record;
|
||||
use ft_core::TraxRecord;
|
||||
use gio::resources_lookup_data;
|
||||
use gtk::STYLE_PROVIDER_PRIORITY_USER;
|
||||
use std::{cell::RefCell, path::PathBuf, rc::Rc};
|
||||
|
@ -125,7 +126,6 @@ impl AppWindow {
|
|||
s
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn show_welcome_view(&self) {
|
||||
let view = View::Welcome(WelcomeView::new({
|
||||
let s = self.clone();
|
||||
|
@ -178,7 +178,6 @@ impl AppWindow {
|
|||
self.layout.append(¤t_widget.widget());
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn on_apply_config(&self, path: PathBuf) {
|
||||
glib::spawn_future_local({
|
||||
let s = self.clone();
|
||||
|
|
|
@ -223,7 +223,6 @@ impl DayDetail {
|
|||
|
||||
pub struct DayEditPrivate {
|
||||
on_finished: RefCell<Box<dyn Fn()>>,
|
||||
#[allow(unused)]
|
||||
workout_rows: RefCell<gtk::Box>,
|
||||
view_model: RefCell<Option<DayDetailViewModel>>,
|
||||
}
|
||||
|
|
|
@ -106,7 +106,6 @@ impl<T: Clone + std::fmt::Debug + 'static> TextEntry<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn time_field<OnUpdate>(
|
||||
value: Option<TimeFormatter>,
|
||||
on_update: OnUpdate,
|
||||
|
@ -123,7 +122,6 @@ where
|
|||
)
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn distance_field<OnUpdate>(
|
||||
value: Option<DistanceFormatter>,
|
||||
on_update: OnUpdate,
|
||||
|
@ -140,7 +138,6 @@ where
|
|||
)
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn duration_field<OnUpdate>(
|
||||
value: Option<DurationFormatter>,
|
||||
on_update: OnUpdate,
|
||||
|
|
|
@ -15,6 +15,7 @@ You should have received a copy of the GNU General Public License along with Fit
|
|||
*/
|
||||
|
||||
use crate::{
|
||||
components::TextEntry,
|
||||
types::{FormatOption, WeightFormatter},
|
||||
};
|
||||
use gtk::prelude::*;
|
||||
|
|
|
@ -53,7 +53,6 @@ impl Iterator for DayIterator {
|
|||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum FormatOption {
|
||||
Abbreviated,
|
||||
#[allow(unused)]
|
||||
Full,
|
||||
}
|
||||
|
||||
|
@ -61,7 +60,6 @@ pub enum FormatOption {
|
|||
pub struct TimeFormatter(chrono::NaiveTime);
|
||||
|
||||
impl TimeFormatter {
|
||||
#[allow(unused)]
|
||||
pub fn format(&self, option: FormatOption) -> String {
|
||||
match option {
|
||||
FormatOption::Abbreviated => self.0.format("%H:%M"),
|
||||
|
@ -70,7 +68,6 @@ impl TimeFormatter {
|
|||
.to_string()
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn parse(s: &str) -> Result<TimeFormatter, ParseError> {
|
||||
let parts = s
|
||||
.split(':')
|
||||
|
@ -107,7 +104,6 @@ impl From<chrono::NaiveTime> for TimeFormatter {
|
|||
pub struct WeightFormatter(si::Kilogram<f64>);
|
||||
|
||||
impl WeightFormatter {
|
||||
#[allow(unused)]
|
||||
pub fn format(&self, option: FormatOption) -> String {
|
||||
match option {
|
||||
FormatOption::Abbreviated => format!("{} kg", self.0.value_unsafe),
|
||||
|
@ -115,7 +111,6 @@ impl WeightFormatter {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn parse(s: &str) -> Result<WeightFormatter, ParseError> {
|
||||
s.parse::<f64>()
|
||||
.map(|w| WeightFormatter(w * si::KG))
|
||||
|
@ -154,7 +149,6 @@ impl From<si::Kilogram<f64>> for WeightFormatter {
|
|||
pub struct DistanceFormatter(si::Meter<f64>);
|
||||
|
||||
impl DistanceFormatter {
|
||||
#[allow(unused)]
|
||||
pub fn format(&self, option: FormatOption) -> String {
|
||||
match option {
|
||||
FormatOption::Abbreviated => format!("{} km", self.0.value_unsafe / 1000.),
|
||||
|
@ -162,7 +156,6 @@ impl DistanceFormatter {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn parse(s: &str) -> Result<DistanceFormatter, ParseError> {
|
||||
let value = s.parse::<f64>().map_err(|_| ParseError)?;
|
||||
Ok(DistanceFormatter(value * 1000. * si::M))
|
||||
|
@ -200,7 +193,6 @@ impl From<si::Meter<f64>> for DistanceFormatter {
|
|||
pub struct DurationFormatter(si::Second<f64>);
|
||||
|
||||
impl DurationFormatter {
|
||||
#[allow(unused)]
|
||||
pub fn format(&self, option: FormatOption) -> String {
|
||||
let (hours, minutes) = self.hours_and_minutes();
|
||||
let (h, m) = match option {
|
||||
|
@ -214,13 +206,11 @@ impl DurationFormatter {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn parse(s: &str) -> Result<DurationFormatter, ParseError> {
|
||||
let value = s.parse::<f64>().map_err(|_| ParseError)?;
|
||||
Ok(DurationFormatter(value * 60. * si::S))
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn hours_and_minutes(&self) -> (i64, i64) {
|
||||
let minutes: i64 = (self.0.value_unsafe / 60.).round() as i64;
|
||||
let hours: i64 = minutes / 60;
|
||||
|
|
|
@ -14,9 +14,7 @@ General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License along with FitnessTrax. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::app::{ReadError, RecordProvider, WriteError};
|
||||
#[allow(unused_imports)]
|
||||
use chrono::NaiveDate;
|
||||
use dimensioned::si;
|
||||
use emseries::{Record, RecordId, Recordable};
|
||||
|
@ -174,7 +172,7 @@ impl DayDetailViewModel {
|
|||
}
|
||||
|
||||
pub fn weight(&self) -> Option<si::Kilogram<f64>> {
|
||||
(*self.weight.read().unwrap()).as_ref().map(|w| w.weight)
|
||||
(*self.weight.read().unwrap()).as_ref().map(|w| (*w).weight)
|
||||
}
|
||||
|
||||
pub fn set_weight(&self, new_weight: si::Kilogram<f64>) {
|
||||
|
@ -279,13 +277,15 @@ impl DayDetailViewModel {
|
|||
)
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn get_record(&self, id: &RecordId) -> Option<Record<TraxRecord>> {
|
||||
let record_set = self.records.read().unwrap();
|
||||
record_set.get(id).map(|record| Record {
|
||||
id: id.clone(),
|
||||
data: (**record).clone(),
|
||||
})
|
||||
match record_set.get(&id) {
|
||||
Some(record) => Some(Record {
|
||||
id: id.clone(),
|
||||
data: (**record).clone(),
|
||||
}),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remove_record(&self, id: RecordId) {
|
||||
|
@ -482,21 +482,21 @@ mod test {
|
|||
Record {
|
||||
id: RecordId::default(),
|
||||
data: TraxRecord::Weight(ft_core::Weight {
|
||||
date: oct_12,
|
||||
date: oct_12.clone(),
|
||||
weight: 93. * si::KG,
|
||||
}),
|
||||
},
|
||||
Record {
|
||||
id: RecordId::default(),
|
||||
data: TraxRecord::Weight(ft_core::Weight {
|
||||
date: oct_13,
|
||||
date: oct_13.clone(),
|
||||
weight: 95. * si::KG,
|
||||
}),
|
||||
},
|
||||
Record {
|
||||
id: RecordId::default(),
|
||||
data: TraxRecord::Steps(ft_core::Steps {
|
||||
date: oct_13,
|
||||
date: oct_13.clone(),
|
||||
count: 2500,
|
||||
}),
|
||||
},
|
||||
|
@ -519,7 +519,7 @@ mod test {
|
|||
|
||||
#[tokio::test]
|
||||
async fn it_honors_only_the_first_weight_and_step_record() {
|
||||
let (view_model, _provider) = create_view_model().await;
|
||||
let (view_model, provider) = create_view_model().await;
|
||||
assert_eq!(view_model.weight(), Some(95. * si::KG));
|
||||
assert_eq!(view_model.steps(), Some(2500));
|
||||
}
|
||||
|
|
|
@ -17,12 +17,12 @@ You should have received a copy of the GNU General Public License along with Fit
|
|||
use crate::{
|
||||
app::App, components::DaySummary, types::DayInterval, view_models::DayDetailViewModel,
|
||||
};
|
||||
|
||||
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use emseries::Record;
|
||||
use ft_core::TraxRecord;
|
||||
use glib::Object;
|
||||
use gtk::{prelude::*, subclass::prelude::*};
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
use std::{cell::RefCell, collections::HashMap, rc::Rc};
|
||||
|
||||
/// The historical view will show a window into the main database. It will show some version of
|
||||
/// daily summaries, daily details, and will provide all functions the user may need for editing
|
||||
|
|
|
@ -30,7 +30,6 @@ pub use welcome_view::WelcomeView;
|
|||
|
||||
pub enum View {
|
||||
Placeholder(PlaceholderView),
|
||||
#[allow(unused)]
|
||||
Welcome(WelcomeView),
|
||||
Historical(HistoricalView),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue