Compare commits
	
		
			No commits in common. "3f15a89d574b2b189be158bd36a227b4b8ac5924" and "54daa904be455559db212476af736fd5d06e1307" have entirely different histories. 
		
	
	
		
			3f15a89d57
			...
			54daa904be
		
	
		
	
								
									
									
										
											18
										
									
									README.md
									
									
									
									
								
								
							
							
										
											18
										
									
									README.md
									
									
									
									
								| 
						 | 
				
			
			@ -97,21 +97,3 @@ To regenerate the frontend client during development:
 | 
			
		|||
```sh
 | 
			
		||||
npm run openapi-generate
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Screenshots
 | 
			
		||||
 | 
			
		||||
### Home
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
### Schedule
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
### Team
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
### Team Settings
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -78,7 +78,6 @@ nav {
 | 
			
		|||
  margin: 0;
 | 
			
		||||
  align-items: center;
 | 
			
		||||
  justify-content: space-between;
 | 
			
		||||
  border-bottom: 1px solid var(--surface-0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nav .nav-links {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,39 +8,6 @@ export const useClientStore = defineStore("client", () => {
 | 
			
		|||
 | 
			
		||||
  const calls = new Map<string, Promise<any>>();
 | 
			
		||||
 | 
			
		||||
  type CachedValue<T> = {
 | 
			
		||||
    value: T,
 | 
			
		||||
    timestamp: number,
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  const cached = new Map<string, any>();
 | 
			
		||||
 | 
			
		||||
  function callCached<T>(
 | 
			
		||||
    key: string,
 | 
			
		||||
    apiCall: () => CancelablePromise<T>,
 | 
			
		||||
    maxLifetime: number = 2000,
 | 
			
		||||
    thenOnce?: (result: T) => T,
 | 
			
		||||
    catchOnce?: (error: any) => any,
 | 
			
		||||
    finallyOnce?: () => void,
 | 
			
		||||
  ): Promise<T> {
 | 
			
		||||
    if (cached.has(key)) {
 | 
			
		||||
      const cachedValue = cached.get(key) as CachedValue<T>;
 | 
			
		||||
      if (Date.now() - cachedValue.timestamp < maxLifetime) {
 | 
			
		||||
        return Promise.resolve(cachedValue.value);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // cache miss
 | 
			
		||||
    let promise = call(key, apiCall, thenOnce, catchOnce, finallyOnce);
 | 
			
		||||
    promise.then((result) => {
 | 
			
		||||
      cached.set(key, {
 | 
			
		||||
        value: result,
 | 
			
		||||
        timestamp: Date.now(),
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
    return promise;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function call<T>(
 | 
			
		||||
    key: string,
 | 
			
		||||
    apiCall: () => CancelablePromise<T>,
 | 
			
		||||
| 
						 | 
				
			
			@ -50,15 +17,11 @@ export const useClientStore = defineStore("client", () => {
 | 
			
		|||
  ): Promise<T> {
 | 
			
		||||
    console.log("Fetching call " + key);
 | 
			
		||||
    if (!calls.has(key)) {
 | 
			
		||||
      console.log("Making new call " + key);
 | 
			
		||||
      const promise = apiCall();
 | 
			
		||||
      calls.set(key, promise);
 | 
			
		||||
 | 
			
		||||
      // remove from calls once completed
 | 
			
		||||
      promise.finally(() => {
 | 
			
		||||
        console.log("Call " + key + " completed");
 | 
			
		||||
        calls.delete(key);
 | 
			
		||||
      });
 | 
			
		||||
      promise.finally(() => calls.delete(key));
 | 
			
		||||
 | 
			
		||||
      // only execute this "then" once if the call was just freshly made
 | 
			
		||||
      if (thenOnce) {
 | 
			
		||||
| 
						 | 
				
			
			@ -74,8 +37,6 @@ export const useClientStore = defineStore("client", () => {
 | 
			
		|||
      }
 | 
			
		||||
 | 
			
		||||
      return promise;
 | 
			
		||||
    } else {
 | 
			
		||||
      console.log("Returning concurrent call " + key);
 | 
			
		||||
    }
 | 
			
		||||
    return calls.get(key) as Promise<T>;
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			@ -83,7 +44,6 @@ export const useClientStore = defineStore("client", () => {
 | 
			
		|||
  return {
 | 
			
		||||
    client,
 | 
			
		||||
    call,
 | 
			
		||||
    callCached,
 | 
			
		||||
    calls,
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ export const useTeamsStore = defineStore("teams", () => {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  async function fetchTeam(id: number) {
 | 
			
		||||
    const response = await clientStore.callCached(
 | 
			
		||||
    const response = await clientStore.call(
 | 
			
		||||
      fetchTeam.name,
 | 
			
		||||
      () => client.default.getTeam(id)
 | 
			
		||||
    );
 | 
			
		||||
| 
						 | 
				
			
			@ -42,7 +42,7 @@ export const useTeamsStore = defineStore("teams", () => {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  async function fetchTeamMembers(id: number) {
 | 
			
		||||
    const response = await clientStore.callCached(
 | 
			
		||||
    const response = await clientStore.call(
 | 
			
		||||
      fetchTeamMembers.name,
 | 
			
		||||
      () => client.default.getTeamMembers(id)
 | 
			
		||||
    );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -117,7 +117,7 @@ class Event(app_db.BaseModel):
 | 
			
		|||
            f"Maximum roles filled: {matchings}" + ringers_needed_msg,
 | 
			
		||||
            "",
 | 
			
		||||
            "[Confirm attendance here]" +
 | 
			
		||||
                f"(https://{domain}/team/id/{self.team.id})",
 | 
			
		||||
                f"(https://{domain}/team/id/{self.team.id}/events/{self.id})",
 | 
			
		||||
        ])
 | 
			
		||||
 | 
			
		||||
    def get_or_create_webhook(self):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
											
												Binary file not shown.
											
										
									
								| 
		 Before Width: | Height: | Size: 97 KiB  | 
											
												Binary file not shown.
											
										
									
								| 
		 Before Width: | Height: | Size: 107 KiB  | 
											
												Binary file not shown.
											
										
									
								| 
		 Before Width: | Height: | Size: 115 KiB  | 
											
												Binary file not shown.
											
										
									
								| 
		 Before Width: | Height: | Size: 221 KiB  | 
		Loading…
	
		Reference in New Issue