Skip to content

Sequence Diagrams ‐ Goal Management

Selman Akman edited this page Oct 17, 2025 · 3 revisions

Set/Create Custom Goal Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":GoalService" as GoalService
participant ":User" as UserObj
participant ":WasteCategory" as CategoryObj

title "Set/Create Custom Goal"

User -> GoalService: createGoal(userID, categoryID, target, timeframe, isCustom)
GoalService -> UserObj: getUser(userID)
alt User Authenticated
    UserObj --> GoalService: userData
    GoalService -> CategoryObj: getCategory(categoryID)
    alt Valid Category
        CategoryObj --> GoalService: categoryData
        GoalService -> GoalService: createGoal(categoryID, target, timeframe, isCustom)
        GoalService --> User: showConfirmation("Goal created")
    else Invalid Category
        CategoryObj --> GoalService: error("Category not found")
        GoalService --> User: showError("Invalid category ID")
    end
else User Not Authenticated
    UserObj --> GoalService: error("User not found")
    GoalService --> User: showError("Please log in")
end

@enduml

Select Predefined Goal Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":GoalService" as GoalService
participant ":User" as UserObj

title "Select Predefined Goal"

User -> GoalService: selectPredefinedGoal(userID, predefinedGoalID)
GoalService -> UserObj: getUser(userID)
alt User Authenticated
    UserObj --> GoalService: userData
    GoalService -> GoalService: getPredefinedGoal(predefinedGoalID)
    alt Valid Predefined Goal
        GoalService --> GoalService: goalData(categoryID, target, timeframe)
        GoalService --> User: showConfirmation("Predefined goal selected")
    else Invalid Goal
        GoalService --> User: showError("Invalid predefined goal ID")
    end
else User Not Authenticated
    UserObj --> GoalService: error("User not found")
    GoalService --> User: showError("Please log in")
end

@enduml

Edit Goal Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":GoalService" as GoalService
participant ":User" as UserObj
participant ":WasteCategory" as CategoryObj

title "Edit Goal"

User -> GoalService: updateGoal(userID, goalID, categoryID, target, timeframe)
GoalService -> UserObj: getUser(userID)
alt User Authenticated
    UserObj --> GoalService: userData
    GoalService -> GoalService: getGoal(goalID)
    alt Goal Exists and Owned
        GoalService -> CategoryObj: getCategory(categoryID)
        alt Valid Category
            CategoryObj --> GoalService: categoryData
            GoalService --> GoalService: updateGoal(goalID, categoryID, target, timeframe)
            GoalService --> User: showConfirmation("Goal updated")
        else Invalid Category
            CategoryObj --> GoalService: error("Category not found")
            GoalService --> User: showError("Invalid category ID")
        end
    else Invalid Goal
        GoalService --> User: showError("Invalid goal ID or not owned")
    end
else User Not Authenticated
    UserObj --> GoalService: error("User not found")
    GoalService --> User: showError("Please log in")
end

@enduml

Track Goal Progress Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":GoalService" as GoalService
participant ":User" as UserObj
participant ":WasteLog" as WasteLogObj
participant ":AchievementService" as AchievementService

title "Track Goal Progress"

User -> GoalService: trackProgress(userID, goalID)
GoalService -> UserObj: getUser(userID)
alt User Authenticated
    UserObj --> GoalService: userData
    GoalService -> GoalService: getGoal(goalID)
    alt Goal Exists
        GoalService -> WasteLogObj: getWasteLogs(userID, categoryID, timeframe)
        alt Logs Found
            WasteLogObj --> GoalService: totalReduced
            GoalService --> GoalService: calculateProgress(totalReduced, target)
            GoalService -> AchievementService: earn(userID, progressPoints, goalID)
            AchievementService --> GoalService: pointsUpdated()
            GoalService --> User: showProgress("Progress: " + progress)
        else No Logs
            WasteLogObj --> GoalService: emptyList
            GoalService --> User: showProgress("No progress yet")
        end
    else Invalid Goal
        GoalService --> User: showError("Invalid goal ID")
    end
else User Not Authenticated
    UserObj --> GoalService: error("User not found")
    GoalService --> User: showError("Please log in")
end

@enduml

Compare Progress Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":GoalService" as GoalService
participant ":User" as UserObj

title "Compare Progress"

User -> GoalService: compareProgress(userID, goalID, timespan)
GoalService -> UserObj: getUser(userID)
alt User Authenticated
    UserObj --> GoalService: userData
    GoalService -> GoalService: getGoal(goalID)
    alt Goal Exists
        GoalService --> GoalService: fetchHistoricalProgress(goalID, timespan)
        alt Historical Data Found
            GoalService --> User: showComparison(currentProgress, historicalProgress)
        else No Historical Data
            GoalService --> User: showComparison(currentProgress, "No historical data")
        end
    else Invalid Goal
        GoalService --> User: showError("Invalid goal ID")
    end
else User Not Authenticated
    UserObj --> GoalService: error("User not found")
    GoalService --> User: showError("Please log in")
end

@enduml

Collaborative Goal Rewards Sequence Diagram

Diagram

image

Code

@startuml
actor System
participant ":ChallengeService" as ChallengeService
participant ":TeamService" as TeamService
participant ":AchievementService" as AchievementService

title "Collaborative Goal Rewards"

System -> ChallengeService: checkTeamGoals()
ChallengeService -> TeamService: getTeamGoals()
alt Team Goals Found
    TeamService --> ChallengeService: teamGoalList
    ChallengeService -> TeamService: trackProgress(teamGoalID)
    alt Goal Complete
        TeamService --> ChallengeService: progressComplete
        ChallengeService -> AchievementService: awardTeamReward(teamID, points)
        AchievementService --> ChallengeService: rewardAwarded()
        ChallengeService --> System: rewardsProcessed()
    else Goal Incomplete
        TeamService --> ChallengeService: progressIncomplete
        ChallengeService --> System: skipRewards()
    end
else No Team Goals
    TeamService --> ChallengeService: emptyList
    ChallengeService --> System: skipRewards()
end

@enduml

Labs

Team Members

Weekly Reports

Ahmet Okta
Barathan Aslan
Berke Kartal
Mehmet Çağlar Kurt
Mehmet Emin Atak
Muhammet Berkay Keskin
Mustafa Taha Söylemez
Nilsu Tüysüz
Selman Akman
Ömer Faruk Bayram

Meetings

Milestones

Templates

Research on Git

Projects

Project Resources

Software Design Diagrams

Documentation(Manuals & Research Doc)

CMPE352 Archive

Projects

Project Resources

Software Design Diagrams

Documentation(Manuals & Research Doc)



Documentation(Individual Contributions and/or Milestone Report)

Individual Contributions

Meeting Notes

Clone this wiki locally