change a bunch of shit to get importing / adding new vote have the right weekday
This commit is contained in:
@@ -60,9 +60,8 @@ struct AddMoodHeaderView: View {
|
||||
}
|
||||
|
||||
private func addItem(withMood mood: Mood) {
|
||||
if let date = ShowBasedOnVoteLogics.dateForHeaderVote(onboardingData: onboardingData) {
|
||||
addItemHeaderClosure(mood, date)
|
||||
}
|
||||
let date = ShowBasedOnVoteLogics.getCurrentVotingDate(onboardingData: onboardingData)
|
||||
addItemHeaderClosure(mood, date)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ struct DayView: View {
|
||||
|
||||
private var headerView: some View {
|
||||
VStack {
|
||||
if ShowBasedOnVoteLogics.isMissingCurrentVote(onboardingData: onboardingData.savedOnboardingData) {
|
||||
if ShowBasedOnVoteLogics.isMissingCurrentVote(onboardingData: UserDefaultsStore.getOnboarding()) {
|
||||
AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in
|
||||
viewModel.add(mood: mood, forDate: date, entryType: .header)
|
||||
})
|
||||
@@ -300,6 +300,7 @@ extension DayView {
|
||||
return $0.forDate! > $1.forDate!
|
||||
}), id: \.self) { entry in
|
||||
if filteredDays.currentFilters.contains(Int(entry.weekDay)) {
|
||||
// let _ = print(entry.forDate, entry.weekDay, filteredDays.currentFilters)
|
||||
EntryListView(entry: entry)
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture(perform: {
|
||||
|
||||
@@ -20,7 +20,6 @@ struct MainTabView: View {
|
||||
let customizeView: CustomizeView
|
||||
|
||||
var body: some View {
|
||||
Self._printChanges()
|
||||
return TabView {
|
||||
dayView
|
||||
.tabItem {
|
||||
|
||||
@@ -109,16 +109,6 @@ struct MonthView: View {
|
||||
}
|
||||
|
||||
extension MonthView {
|
||||
private var topView: some View {
|
||||
VStack {
|
||||
if ShowBasedOnVoteLogics.isMissingCurrentVote(onboardingData: onboardingData.savedOnboardingData) {
|
||||
Text("Vote")
|
||||
}
|
||||
Text("dis top")
|
||||
.foregroundColor(theme.currentTheme.secondaryBGColor)
|
||||
}
|
||||
}
|
||||
|
||||
private var settingsButtonView: some View {
|
||||
HStack {
|
||||
Spacer()
|
||||
@@ -204,7 +194,6 @@ extension MonthView {
|
||||
LazyVGrid(columns: columns, spacing: 15) {
|
||||
ForEach(entries, id: \.self) { entry in
|
||||
if filteredDays.currentFilters.contains(Int(entry.weekDay)) {
|
||||
let _ = print(entry.weekDay, entry.forDate, filteredDays.currentFilters, entry.id)
|
||||
shape.view(withText: Text(""),
|
||||
bgColor: entry.mood == .placeholder ? .clear : moodTint.color(forMood: entry.mood),
|
||||
textColor: .clear)
|
||||
|
||||
@@ -95,7 +95,7 @@ struct SettingsView: View {
|
||||
guard let selectedFile: URL = try result.get().first else { return }
|
||||
if selectedFile.startAccessingSecurityScopedResource() {
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss +0000"
|
||||
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
|
||||
dateFormatter.timeZone = TimeZone(abbreviation: "UTC")
|
||||
|
||||
guard let input = String(data: try Data(contentsOf: selectedFile), encoding: .utf8) else { return }
|
||||
@@ -104,7 +104,8 @@ struct SettingsView: View {
|
||||
var rows = input.components(separatedBy: "\n")
|
||||
rows.removeFirst()
|
||||
for row in rows {
|
||||
let columns = row.components(separatedBy: ",")
|
||||
let stripped = row.replacingOccurrences(of: " +0000", with: "")
|
||||
let columns = stripped.components(separatedBy: ",")
|
||||
if columns.count != 7 {
|
||||
continue
|
||||
}
|
||||
@@ -112,13 +113,13 @@ struct SettingsView: View {
|
||||
moodEntry.canDelete = Bool(columns[0])!
|
||||
moodEntry.canEdit = Bool(columns[1])!
|
||||
moodEntry.entryType = Int16(columns[2])!
|
||||
moodEntry.forDate = dateFormatter.date(from: columns[3])
|
||||
moodEntry.forDate = dateFormatter.date(from: columns[3])!
|
||||
moodEntry.moodValue = Int16(columns[4])!
|
||||
moodEntry.timestamp = dateFormatter.date(from: columns[5])
|
||||
moodEntry.timestamp = dateFormatter.date(from: columns[5])!
|
||||
|
||||
let localTime = dateFormatter.date(from: columns[3])!.toLocalTime()
|
||||
let localTime = dateFormatter.date(from: columns[3])!
|
||||
moodEntry.weekDay = Int16(Calendar.current.component(.weekday, from: localTime))
|
||||
|
||||
// let _ = print("import info: ", columns[3], dateFormatter.date(from: columns[3]), localTime, Int16(Calendar.current.component(.weekday, from: localTime)))
|
||||
try! PersistenceController.shared.viewContext.save()
|
||||
}
|
||||
PersistenceController.shared.saveAndRunDataListerners()
|
||||
@@ -508,7 +509,7 @@ struct TextFile: FileDocument {
|
||||
let weekDay = entry.weekDay
|
||||
|
||||
let dataString = "\(canDelete),\(canEdit),\(entryType),\(String(describing: forDate)),\(moodValue),\(String(describing:timestamp)),\(weekDay)\n"
|
||||
print("DATA: \(dataString)")
|
||||
// print("DATA: \(dataString)")
|
||||
csvString = csvString.appending(dataString)
|
||||
}
|
||||
text = csvString
|
||||
|
||||
Reference in New Issue
Block a user